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

Christian Heimes lists at cheimes.de
Mon Dec 10 21:07:45 CET 2007


Phillip J. Eby wrote:
> The "Importing" package implements callbacks as an extension of lazy
> imports, but it isn't the only way to do it.  Christian's patch
> implements callbacks without lazy importing, although I think it still
> needs a hook (such as his previously-proposed '__lazy__' attribute) to
> let it interoperate with lazy-importing systems.

My local sandbox has a new function PyModule_IsLazy(). It is used by the
post import hook system and imp.is_lazy() to query the status of a
module object. If imp.is_lazy(module) returns True then the post import
hooks aren't called and the lazy import system is responsible to call
imp.post_import_notify(module).

Christian


More information about the Python-3000 mailing list