Message242182
> I don't see any reason for proxy objects to be less hashable than ref objects.
The difference is that unlike a ref object, a proxy object is supposed to forward its method calls to the proxied object. So consider what happens if you forward the __hash__ method to the proxied object: the hash will change when the object dies.
A proxy object could, of course, not forward the __hash__ method, instead computing its own hash. But I think this would do more harm than good: surely most attempts to store weakref.Proxy objects in sets or dictionaries are going to be mistakes -- the user should have used a WeakKeyDictionary or a WeakSet instead. |
|
Date |
User |
Action |
Args |
2015-04-28 12:54:51 | gdr@garethrees.org | set | recipients:
+ gdr@garethrees.org, gvanrossum, fdrake, pitrou, benjamin.peterson, ereuveni |
2015-04-28 12:54:51 | gdr@garethrees.org | set | messageid: <1430225691.71.0.483222803798.issue24067@psf.upfronthosting.co.za> |
2015-04-28 12:54:51 | gdr@garethrees.org | link | issue24067 messages |
2015-04-28 12:54:51 | gdr@garethrees.org | create | |
|