Gareth Rees added the comment:

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

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue24067>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to