[Python-3000] PEP: Eliminate __del__

Greg Ewing greg.ewing at canterbury.ac.nz
Mon May 7 03:40:10 CEST 2007


Giovanni Bajo wrote:
> What I really meant was:
> 
>    self.__wr = weakref.ref(self, ...)

Okay, that looks better. But I'm not sure what will
happen if the holder becomes part of a cycle. If the
GC picks the holder as the object to clear to break
the cycle, then the weakref will be deallocated
before the holder, and the callback won't be called.
So it doesn't seem to be an improvement over __del__.

--
Greg



More information about the Python-3000 mailing list