[issue2603] Make range __eq__ work

Alexander Belopolsky report at bugs.python.org
Wed Apr 16 04:50:49 CEST 2008


Alexander Belopolsky <belopolsky at users.sourceforge.net> added the comment:

On Tue, Apr 15, 2008 at 10:21 PM, Benjamin Peterson
<report at bugs.python.org> wrote:
>  I'm not really sure what to do about the hash. I
>  just removed the Py_SIZE parts. I hope that's OK.

If you want to maintain hash(range(a,b,c)) == hash((a,b,c)) invariant,
you need to replace len with 3, not 0.  While I think your latest
implementation is ok, reproducing tuple hash will make correctness
more obvious.

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2603>
__________________________________


More information about the Python-bugs-list mailing list