Questions about no more nested imports

Dave LeBlanc whisper at oz.net
Sun Mar 11 14:02:45 EST 2001


I'm a bit confused by this. 

It appears that if this is enforced, one can no longer dynamically
load extensions/whatever dynamically and all imports must be done at
the top of a module prior to anticipated use - whether used or not. If
this is true, then load times for python apps could go up drastically.

The other thing I can't figure out is how to dynamically load
extensions based on their discovery at run time - for example, a
plugins directory whose content might change from one invocation to
another. Since, as I understand it, I have to do all imports at the
top of the file, how am I going to discover and import such new
extensions without executing any code to do so?

No conditional loading either I guess? How about imports needed by "if
__main__" but not needed if used  as a libarary?

Dave LeBlanc



More information about the Python-list mailing list