dynamic modules
Michael Hudson
mwh at python.net
Tue Dec 18 13:56:40 EST 2001
Fernando Pérez <fperez528 at yahoo.com> writes:
> Marek Budyn wrote:
>
> > Hi!
> >
> > I wanted go create dynamically loaded and removed plugins. I mean, id a
> > module a initalizes with 10 MB data structude, i would like to remove it
> > from memory if it is not needed eg.
> >
> > p1 = import plugin1
> >
> > ...
> >
> > unload(p1)
> >
> > Is it possible in python ? And if so, how can I do this ?
> > Thanks for help!
>
> import plugin1 as p1
>
> ...
>
> del p1
>
>
> In the next gc pass it should get picked up.
This won't work; consider sys.modules.
unloading has been a topic of discussion on python-dev in the last few
days, but no conclusions have been reached. It's a hard problem.
CHeers,
M.
--
"An infinite number of monkeys at an infinite number of keyboards
could produce something like Usenet."
"They could do a better job of it."
-- the corollaries to Gene Spafford's Axiom #2 of Usenet
More information about the Python-list
mailing list