Generate a new object each time a name is imported
Peter Otten
__peter__ at web.de
Sun Aug 2 08:19:01 EDT 2009
wrote:
KNode cannot parse your From-string correctly. Strange.
> Peter Otten <__peter__ at web.de> writes:
>> >>> import sys
>> >>> sys.modules["yadda"] = A()
>
> OMG.... wow. I bow to you. But I'm not sure whether that's bowing in
> awe or in terror.
I don't know who invented it, but it's an old trick. It even made it into
the standard library (email.LazyImporter).
For the record: I don't recommend it.
Peter
More information about the Python-list
mailing list