del()?
David Allen
mda at idatar.com
Wed Apr 4 21:37:22 EDT 2001
In article <Pine.LNX.4.21.0104042019020.17701-100000 at tarpon.exis.net>, "Jay
Collins" <jcollin at exis.net> wrote:
> does del() free the ram used by string?
I'm not sure, but it definately nukes it from
python's environment so you can't use it anymore.
It is likely that it frees the ram but maybe not
right at that instant.
> like
>
> a = "my string"
> del(a)
>
> will I get my ram back? Should I even worry about this since gc takes care
> of this?
I usually use del() exclusively to get rid of
keys to dictionaries. As in:
>>> d = {}
>>> d['foo'] = 'bar'
>>> d['baz'] = 'quux'
>>> d
{'foo': 'bar', 'baz': 'quux'}
>>> del(d['foo'])
>>> d
{'baz': 'quux'}
>>>
--
David Allen
http://opop.nols.com/
----------------------------------------
Marriage is the only adventure open to the cowardly.
-- Voltaire
More information about the Python-list
mailing list