What does "del" actually do?

Calvin Spealman ironfroggy at gmail.com
Sat Feb 10 12:36:35 EST 2007


del simply removes the name in the current scope. if that happens to
be the last non-cyclic reference to the object it was bound to, then
it will remove the objec to, but thats a seperate matter. if you
remove the class and there are instances out there, they can only
exist if there are some other references to them, so no, they arent
deleted.

del wont just delete a bunch of objects and leave broken names. i has
nothing to do with deleting objects, only names.

On 2/10/07, John Nagle <nagle at animats.com> wrote:
>     The Python "reference manual" says, for "del", "Rather that spelling it out
> in full details, here are some hints."  That's not too helpful.
>
>     In particular, when "del" is applied to a class object, what happens?
> Are all the instance attributes deleted from the object?  Is behavior
> the same for both old and new classes?
>
>     I'm trying to break cycles to fix some memory usage problems.
>
>                                         John Nagle
> --
> http://mail.python.org/mailman/listinfo/python-list
>


-- 
Read my blog! I depend on your acceptance of my opinion! I am interesting!
http://ironfroggy-code.blogspot.com/



More information about the Python-list mailing list