[Python-3000] PEP: Eliminate __del__

Greg Ewing greg.ewing at canterbury.ac.nz
Sun May 6 01:14:30 CEST 2007


Giovanni Bajo wrote:

> Uh? If __dict__ contains a cycle back to the original object, then the object 
> is part of a cycle already, with or without getting an additional reference to 
> the __dict__ within the finalization callback.

Yes, but storing a finalizer in a global registry that
references the __dict__ makes it an *immortal* cycle,
because the GC won't see it as an isolated cycle that's
not referenced from outside.

> And if there's no cycle, you're not creating one by just 
 > referencing __dict__.

It's not creation of the cycle that's the issue, it's
keeping it alive forever once it's created.

--
Greg


More information about the Python-3000 mailing list