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

Paul Moore p.f.moore at gmail.com
Mon Dec 10 18:16:25 CET 2007


On 10/12/2007, Jim Jewett <jimjjewett at gmail.com> 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."

That sounds to me exactly like the registration use case Christian mentioned:

Register decimal.Decimal as a "ABC.Number" type - but don't import
decimal just so that I can do this, rather wait and do the
registration as soon as the code executes "import decimal" explicitly.

Paul.


More information about the Python-3000 mailing list