[docs] [issue15412] Note in documentation for weakrefs
Antoine Pitrou
report at bugs.python.org
Sat Jul 21 12:23:53 CEST 2012
Antoine Pitrou <pitrou at free.fr> added the comment:
> In the documentation on weakrefs there is the following quote
>
> Note: Weak references to an object are cleared before the object’s
> __del__() is called, to ensure that the weak reference callback
> (if any) finds the object still alive.
>
> But I think the weakref is always dead by the time the callback is
> invoked.
It's true, the doc needs fixing.
> Which does prompt a question: what use is there for the weakref
> argument to the callback if it already dead?
The weakref is "dead" but it's still a weakref, and it can be used to
e.g. index a container of existing weakrefs (cf. WeakSet,
WeakKeyDictionary, WeakValueDictionary).
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15412>
_______________________________________
More information about the docs
mailing list