Newbie namespace question
peter at engcorp.com
Wed Dec 22 21:27:38 CET 2004
> i believe that to avoid circular refs errors remember you can
> lazy-import, for example here i'm importing the email package:
>>>> m = __import__('email')
> <module 'email' from 'C:\Python\lib\email\__init__.pyc'>
> check help(__import__) for futher details.
I'm not sure what you think that does, but I don't
think it does it.
The code you show above is no more "lazy" than a simple
"import email as m" would have been, I believe.
All statements are executed as they are encountered
during import, so any that are no inside a function
or class definition, or protected by a conditional
control structure in some way, will be executed right
away, rather than lazily.
I may have misinterpreted what you were trying to say...
More information about the Python-list