Modules, namespaces, parents, and import

Aahz aahz at
Thu Feb 5 14:44:13 CET 2004

In article <1022p0elv2vsd98 at>,
R Baumann <rynt at> wrote:
>"Aahz" <aahz at> wrote in message
>news:bvrinb$gpc$1 at
>> In article <102247ofva9do52 at>,
>> R Baumann <rynt at> wrote:
>>>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?
>Just a for instance -- Let's suppose that I had a fairly large
>"configuration loader" module that is used once in an application, and
>is never called upon again.  Why not "unload" or "release" that module
>from the interpreter's workspace, freeing up that chunk of memory?  If
>there's no need to use the module again, there's no need to keep it in
>memory, right?

What is "fairly large"?  If you mean that the data it loads is large,
but no longer needed after initalization, it should be simple enough to
discard the data -- provided you really don't need it.  If you mean that
the code is large, I've got a difficult time imagining a module large
enough to make a different to a Python application on a typical modern
Aahz (aahz at           <*>

"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