[issue4701] range objects becomes hashable after attribute access

Hagen Fürstenau report at bugs.python.org
Sat Dec 20 09:15:39 CET 2008


Hagen Fürstenau <hfuerstenau at gmx.net> added the comment:

> I don't believe there is any driving reason for them not to be hashable.

On the other hand, what is the use case for hashing objects whose
equality is defined as object identity?

Python 3.0 (r30:67503, Dec  4 2008, 06:47:38)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> range(10).__hash__
<method-wrapper '__hash__' of range object at 0x7f2d61dbd210>
>>> {range(10), range(10)}
{range(0, 10), range(0, 10)}

I can see only confusion arising from that.

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


More information about the Python-bugs-list mailing list