When (and why) to use del?

Bruno Desthuilliers bdesth.quelquechose at free.quelquepart.fr
Tue Dec 9 14:39:35 EST 2008


malkarouri a écrit :
(snip)

> The del statement doesn't actually free memory. It just removes the
> binding from the corresponding namespace. So in your first example,
> my_string cannot be used after the deletion. Of course, if the string
> referenced by my_string was referenced by some other name then it will
> still stay in memory.

And even if it wasn't, and as such ends up being garbage-collected, this 
doesn't mean the allocated memory will go back to the system.

(snip)



More information about the Python-list mailing list