This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gdr@garethrees.org
Recipients benjamin.peterson, ereuveni, fdrake, gdr@garethrees.org, gvanrossum, pitrou
Date 2015-04-28.12:54:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1430225691.71.0.483222803798.issue24067@psf.upfronthosting.co.za>
In-reply-to
Content
> 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.
History
Date User Action Args
2015-04-28 12:54:51gdr@garethrees.orgsetrecipients: + gdr@garethrees.org, gvanrossum, fdrake, pitrou, benjamin.peterson, ereuveni
2015-04-28 12:54:51gdr@garethrees.orgsetmessageid: <1430225691.71.0.483222803798.issue24067@psf.upfronthosting.co.za>
2015-04-28 12:54:51gdr@garethrees.orglinkissue24067 messages
2015-04-28 12:54:51gdr@garethrees.orgcreate