[docs] [issue15412] Note in documentation for weakrefs

Antoine Pitrou report at bugs.python.org
Sat Jul 21 12:59:29 CEST 2012


Antoine Pitrou <pitrou at free.fr> added the comment:

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

They are unhashable if you didn't hash them alive. Otherwise they retain
their old hash value (which is quite useful :-)).

----------

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


More information about the docs mailing list