Jack Bates wrote:
Python's __del__ or destructor method works (above) - but only in the absence of reference cycles (below). An object, with a __del__ method, in a reference cycle, causes all objects in the cycle to be "uncollectable".
Store a weak reference to the object somewhere with a callback. This should work even in the presence of cycles, as long as the weak reference itself isn't part of the cycle. -- Greg -- http://mail.python.org/mailman/listinfo/python-list