The new pythonista_startup feature is nice. The fact that any globals coming from pythonista_startup aren't removed is also nice. Especially because I can now do this:
from __future__ import division, print_function
import sys
import types
class ContainAllTheThings(list):
def __getitem__(self, key):
try:
return super(ContainAllTheThings, self).__getitem__(key)
except (IndexError, KeyError):
return None
def __contains__(self, obj):
return super(ContainAllTheThings, self).__contains__(obj) or True
class DirAllTheThings(types.ModuleType):
def __dir__(self):
return ContainAllTheThings()
new_module = DirAllTheThings(__name__, __doc__)
vars(new_module).update(vars(sys.modules["pythonista_startup"]))
sys.modules["pythonista_startup"] = new_module
(Can't we just have an option to keep all globals? ;))