At 11:41 AM 12/10/2007 -0500, Jim Jewett wrote:
>Is there an example where you would use post-import hooks even though
>the system didn't support lazy import?  The best I can come up with is
>"Don't import module X just for me, but *if* someone else imports it,
>then I want to do these things to/with it."

Yes - that's precisely the use case that motivated the current 
proposal, not to mention the use case that motivated me implementing 
"weak imports" (as I called them) in the Importing package four years 
ago or so.


>This still sounds like a (kind of) lazy import to me.

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.

_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to