Facundo Batista wrote: > Feel free to do it. But note, that some imports are inside the call() > function, this could have more implications that you see (at least I > saw) at first glance.
CC to get Guido's attention First of all I don't understand what you mean with "that some imports are inside the call() function". Please elaborate on it. I skimmed through the code and found just a handful of modules that are important by name as well as imported more than once through the life time of a python process. The most noticeable modules are time, _strptime, resource, unicodedata and warnings. The other modules like __builtin__, zlib and warnings are just loaded once or twice during the boot strapping of the interpreter. Guido: What do you think about storing the modules in an "extern PyObject *PyMod_Spam" variable? I could either store them when they are used the first time or I could load them in Py_InitializeEx. Christian $ find -name '*.c' | xargs grep PyImport_ImportModule\(\" ./Objects/unicodeobject.c: m = PyImport_ImportModule("unicodedata"); ./Objects/exceptions.c: bltinmod = PyImport_ImportModule("__builtin__"); ./PC/bdist_wininst/install.c: mod = PyImport_ImportModule("__builtin__"); ./Modules/_ctypes/callbacks.c: mod = PyImport_ImportModule("ctypes"); ./Modules/_ctypes/callbacks.c: mod = PyImport_ImportModule("ctypes"); ./Modules/cPickle.c: if (!( copy_reg = PyImport_ImportModule("copy_reg"))) ./Modules/cPickle.c: if (!( t=PyImport_ImportModule("__builtin__"))) return -1; ./Modules/posixmodule.c: PyObject *m = PyImport_ImportModule("resource"); ./Modules/zipimport.c: zlib = PyImport_ImportModule("zlib"); /* import zlib */ ./Modules/datetimemodule.c: PyObject *time = PyImport_ImportModule("time"); ./Modules/datetimemodule.c: PyObject *time = PyImport_ImportModule("time"); ./Modules/datetimemodule.c: time = PyImport_ImportModule("time"); ./Modules/datetimemodule.c: if ((module = PyImport_ImportModule("time")) == NULL) ./Modules/timemodule.c: PyObject *strptime_module = PyImport_ImportModule("_strptime"); ./Modules/timemodule.c: m = PyImport_ImportModule("time"); ./Modules/gcmodule.c: tmod = PyImport_ImportModule("time"); ./Modules/main.c: runpy = PyImport_ImportModule("runpy"); ./Modules/main.c: v = PyImport_ImportModule("readline"); ./Modules/parsermodule.c: copyreg = PyImport_ImportModule("copy_reg"); ./Modules/_cursesmodule.c: PyObject *m = PyImport_ImportModule("curses"); ./Python/mactoolboxglue.c: m = PyImport_ImportModule("MacOS"); ./Python/pythonrun.c: warnings_module = PyImport_ImportModule("warnings"); ./Python/pythonrun.c: PyObject *bimod = PyImport_ImportModule("__builtin__"); ./Python/pythonrun.c: m = PyImport_ImportModule("site"); ./Python/errors.c: mod = PyImport_ImportModule("warnings"); ./Python/import.c: zimpimport = PyImport_ImportModule("zipimport"); ./Doc/tools/sphinx/jinja/_speedups.c: PyObject *datastructure = PyImport_ImportModule("jinja.datastructure"); ./Mac/Modules/MacOS.c: m = PyImport_ImportModule("macresource"); _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com