[Python-Dev] PEP: Lazy module imports and post import hook (original) (raw)

Brett Cannon brett at python.org
Wed Jan 9 21:12:07 CET 2008


On Jan 9, 2008 7:38 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:

Nick Craig-Wood wrote: > Christian Heimes <lists at cheimes.de> wrote: >> I've attached the first public draft of my first PEP. > > Some brief thoughts from me on the PEP... > > Post import hooks sound great and a good idea. > > Lazy importing sounds like a recipe for hard to find bugs and rather > too magic for my taste. > > Perhaps you should separate these two things into two PEPs and > implementations? >

And now that I think about it some more, so long as the post-import hook implementation recognises that lazy import libraries exist, all it really needs to do is provide a way for the externally implemented lazy import to trigger whatever import hooks have been registered when the module is finally loaded. So count me in with the people that think it is worth separating the two ideas - just focus in the PEP on the API needed to make it possible for 3rd party implementation of lazy imports to interoperate correctly with the post-import hooks, without proposing to add such an implementation directly to the standard library.

I agree with Nick and Nick. This should really be two separate PEPs.

-Brett



More information about the Python-Dev mailing list