[docs] [issue15412] Note in documentation for weakrefs

Richard Oudkerk report at bugs.python.org
Sat Jul 21 12:58:22 CEST 2012


Richard Oudkerk <shibturn at gmail.com> added the comment:

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

Ah.

I had assumed that since dead weakrefs were unhashable you couldn't safely use them as keys in a dict.  (Presumably removal of a no longer hashable key from a dict is O(n)?)

I also hadn't realize that weakrefs were subclassable.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15412>
_______________________________________


More information about the docs mailing list