[Python-3000] Interest in PEP for callbacks on module import

Greg Ewing greg.ewing at canterbury.ac.nz
Sun Dec 9 00:37:30 CET 2007


Phillip J. Eby wrote:

> Lazy importing is putting a module object into sys.modules, but not 
> loading its contents until you attempt to get or set a module attribute.

How is that expected to be useful? If you're not going
to access any attributes of a module, why can you simply
not import it in the first place?

It wouldn't be sufficient for my intended uses of lazy
importing, where I need the import to be triggered by
accessing a specific attribute of a *different* module
(namely a package which imports classes from submodules
and puts their names in its own namespace).

--
Greg


More information about the Python-3000 mailing list