[Python-ideas] simpler weakref.finalize
d3matt at gmail.com
Mon Apr 11 17:22:25 EDT 2016
Currently, if I want to have weakref.finalize call an object's cleanup method,
I have to do something like:
_finalizer = None
self._finalizer = weakref.finalize(self,
def _cleanup(cls, func):
if self._finalizer is not None:
It wouldn't be difficult to have weakref.finalize automatically handle the
conversion to WeakMethod and automatically attempt to dereference then call
the function passed in.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas