[Python-Dev] PEP: Lazy module imports and post import hook

Phillip J. Eby pje at telecommunity.com
Wed Jan 9 06:09:41 CET 2008


At 06:01 AM 1/9/2008 +0100, Christian Heimes wrote:
>However the PEP covers only the basic infrastructure for lazy imports.
>For example imp.lazy_import("a.b.c") doesn't put "a" and "a.b" in
>sys.modules.

That's probably a mistake.  In the early days of peak.util.imports 
(which is now available as the "Importing" package on PyPI), I went 
through a lot of hairy edge conditions regarding such matters as when 
parent packages must be present, and ensuring the correct runtime 
ordering of post-import callbacks.

Although I glanced at some of your earlier patch versions and had 
comments, you should be aware that I have *not* validated it for 
these sorts of trickier timing considerations, mostly because I'm not 
100% sure what they are any more, only that I made sure 
peak.util.imports could handle them.



More information about the Python-Dev mailing list