Modules, namespaces, parents, and import

R Baumann rynt at 9yahoo.com
Thu Feb 5 17:07:17 CET 2004


"Aahz" <aahz at pythoncraft.com> wrote in message
news:bvthbd$n6a$1 at panix2.panix.com...
> In article <1022p0elv2vsd98 at corp.supernews.com>,
> R Baumann <rynt at 9yahoo.com> wrote:
> >"Aahz" <aahz at pythoncraft.com> wrote in message
> >news:bvrinb$gpc$1 at panix1.panix.com...
> >> In article <102247ofva9do52 at corp.supernews.com>,
> >> R Baumann <rynt at 9yahoo.com> 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
> machine.

Yes, I meant the code.  However, if you don't think this is a problem, I
won't worry about it.
Do you have any idea what the limits are to Python in regards to large
applications in the 20-30MB range.  I would probably suppose the answer is
"there is no problem". :-)

Thanks for the input.

Ruben





More information about the Python-list mailing list