On 12/9/07, Christian Heimes <[EMAIL PROTECTED]> wrote:
> Jim Jewett wrote:
> > Could you give me a use-case for post-import hooks *without* lazy imports?
> This thread was started with perfect valid and good use case. We want to
> apply ABCs to classes of optional modules like decimal and array without
> loading the module or modifying the module.
>
> @imp.imported('decimal')
> def register(decimal):
> Inexact.register(decimal.Decimal)
>
> Lazy imports won't do the trick because the register could would load
> the real module. As you can see the problem can be solved with a post
> import hook but *not* with lazy imports.
I had thought that wouldn't be run until the module was otherwise
loaded. Are you saying that just creating the callback forces a load
under lazy loading, but not under post-load hooks?
-jJ
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com