Message242178
The documentation says that weakref.Proxy objects are not hashable because "this avoids a number of problems related to their fundamentally mutable nature, and prevent their use as dictionary keys".
Hashable objects must be immutable, otherwise the hash might change, invalidating the invariants that make dictionaries work, but Proxy objects are fundamentally mutable: when there are no more strong references to the proxied object, the object gets destroyed and the Proxy object now refers to None. If the Proxy object were hashable then its hash would change at this point. |
|
Date |
User |
Action |
Args |
2015-04-28 11:42:46 | gdr@garethrees.org | set | recipients:
+ gdr@garethrees.org, gvanrossum, fdrake, pitrou, benjamin.peterson, ereuveni |
2015-04-28 11:42:46 | gdr@garethrees.org | set | messageid: <1430221366.62.0.437252097586.issue24067@psf.upfronthosting.co.za> |
2015-04-28 11:42:46 | gdr@garethrees.org | link | issue24067 messages |
2015-04-28 11:42:45 | gdr@garethrees.org | create | |
|