PyDocs

Nav

Data Types

finalize.detach

weakref

method of finalize (source)
  • finalize.detach()
If alive then mark as dead and return (obj, func, args, kwargs);
otherwise return None
1 Example
>>> obj = Object()
>>> f = weakref.finalize(obj, callback, 1, 2, z=3)
>>> f.detach()
(<...Object object ...>, <function callback ...>, (1, 2), {'z': 3})
>>> newobj, func, args, kwargs = _
>>> assert not f.alive
>>> assert newobj is obj
>>> assert func(*args, **kwargs) == 6
CALLBACK
from the Python docs
See Also
No see-alsos for weakref/finalize.detach
0 Notes
No notes for finalize.detach