Modules, namespaces, parents, and import

Aahz aahz at pythoncraft.com
Wed Feb 4 20:55:23 CET 2004


In article <102247ofva9do52 at corp.supernews.com>,
R Baumann <rynt at 9yahoo.com> wrote:
>
>I'm a newbie too.  Just to be perfectly clear about this, if you have a
>half-dozen modules in an application, and you import Sys in everyone of
>them, I am going to assume that Python will only load one instance of Sys.
>When it hits the import statement to load Sys in the other modules, it knows
>that Sys is already loaded and will simply create a link to the already
>existing namespace?

That's essentially correct.

>Is there any way to unload a module after you're finished with it and
>will absolutely no longer need it?

In theory, yes; in practice, no.  Why do you want to do this?
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"The joy of coding Python should be in seeing short, concise, readable
classes that express a lot of action in a small amount of clear code -- 
not in reams of trivial code that bores the reader to death."  --GvR



More information about the Python-list mailing list