[Numpy-discussion] clear a variable
Russell E Owen
rowen at u.washington.edu
Thu Aug 12 14:19:09 EDT 2004
At 4:54 PM -0400 2004-08-12, Andrew Wilson wrote:
Hello,
I can't seem to find this in the documentation, is there a way to
clear a variable. For example I have an application that opens
displays a bunch of images, they can be big memory hogs. When I'm not
showing them I'd like to clear out those variables, instead of having
to close down my program and start over. I know matlab has a command
"clear var" which will do exactly that.
del(obj)
If you are the only user of "obj", this'll do the trick. (del tries
to be polite and not pull the rug out from under other users).
obj can be nearly anything, such as an array or any other object you
created. del can also be used to delete specific elements of lists
and dictionaries, i.e.:
del(adict[akey])
del(alist[ind1:ind2])
I hope this help.
-- Russell
More information about the NumPy-Discussion
mailing list