Antoine Pitrou <pit...@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 <rep...@bugs.python.org>
<http://bugs.python.org/issue15412>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to