Significant speedup -- when a submodule imports a global module, add a
dummy entry to sys.modules, marking the absence of a submodule by the
same name.

Thus, if module foo.bar executes the statement "import time",
sys.modules['foo.time'] will be set to None, once the absence of a
module foo.time is confirmed (by looking for it in foo's path).

The next time when foo.bar (or any other submodule of foo) executes
"import time", no I/O is necessary to determine that there is no
module foo.time.

(Justification: It may seem strange to pollute sys.modules.  However,
since we're doing the lookup anyway it's definitely the fastest
solution.  This is the same convention that 'ni' uses and I haven't
heard any complaints.)
1 file changed