This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pitrou
Recipients docs@python, pitrou, sbt
Date 2012-07-21.10:23:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1342866122.3492.6.camel@localhost.localdomain>
In-reply-to <1342863718.26.0.49587627068.issue15412@psf.upfronthosting.co.za>
Content
> 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).
History
Date User Action Args
2012-07-21 10:23:53pitrousetrecipients: + pitrou, docs@python, sbt
2012-07-21 10:23:52pitroulinkissue15412 messages
2012-07-21 10:23:52pitroucreate