Modules, namespaces, parents, and import

R Baumann rynt at 9yahoo.com
Wed Feb 4 10:34:22 EST 2004


"Dietrich Epp" <dietrich at zdome.net> wrote in message
news:mailman.1186.1075877977.12720.python-list at python.org...

SNIP

>
> On Feb 3, 2004, at 10:28 PM, Dan Williams wrote:
>  If you import sys  directly, you don't have to retrieve it from 'parent'
every time, and
> no, this does not load additional code -- it just references the
> already loaded module.
>
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?

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

Thanks
Ruben





More information about the Python-list mailing list