Generate a new object each time a name is imported

Peter Otten __peter__ at
Sun Aug 2 14:19:01 CEST 2009


KNode cannot parse your From-string correctly. Strange.

> Peter Otten <__peter__ at> 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.


More information about the Python-list mailing list