[Python-Dev] Making weakref callbacks safe in cyclic gc

Fred L. Drake, Jr. fred at zope.com
Mon Nov 17 16:58:01 EST 2003


Neil Schemenauer writes:
 > I did not know that.

The callback is intended to be a notification that the referenced
object has gone away for anyone who's still interested.  To "lose
interest", you can just throw away you're reference.

 > I suppose if __del__ method continued to work the way they do,
 > people could just use weakref callbacks to do finalization.

Sigh.  So then everyone would wonder why the destructor registration
is done through the weakref module.  And constructors would assign a
weakref with a callback to an attribute on self.

Sounds nasty.


  -Fred

-- 
Fred L. Drake, Jr.  <fred at zope.com>
PythonLabs at Zope Corporation



More information about the Python-Dev mailing list