Message166006
| 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). |
|