newbie question - remove a module from ram

Paul McGuire ptmcg at austin.rr._bogus_.com
Mon May 10 09:09:14 EDT 2004


"john fabiani" <jfabiani at yolo.com> wrote in message
news:4AAnc.6791$dH5.4946 at newssvr27.news.prodigy.com...
> Hi,
>
> I believe I have good understanding of import but it occurred to me that
> I might want to remove an imported module.  I.e I load a module into ram
> and I no longer need the module.  Modules just stays in ram?  In the
> windows world I would "thisform.release()"  and the garbage collector
> would release the ram.  So did I miss something or is there no release
> method.  How about a method within a class like destroy()?
>
> I just got to believe it's there????  But where?
> John

Well, you were pretty close with calling something like .release().  Use the
del statement.

>>> import random
>>> print random.random()
0.475899061786
>>> del random
>>> print random.random()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
NameError: name 'random' is not defined
>>>

-- Paul





More information about the Python-list mailing list