[issue2603] Make range __eq__ work

Amaury Forgeot d'Arc report at bugs.python.org
Fri Apr 25 23:57:49 CEST 2008


Amaury Forgeot d'Arc <amauryfa at gmail.com> added the comment:

about range_eq7.patch:

- Did you change your mind about range equality?
  range(0,10,2) == range(0,9,2)
seems True now; it was not with range_eq6.patch

- The hash function will fail with big values (and wrongly returns a
value even when an exception is set). I suggest to call PyObject_Hash
instead of PyNumber_AsSsize_t.

- Now that you short-circuit the comparison, it is enough to have only
one boolean variable (is_equal), which may replace all uses of
start_same, stop_same and step_same.

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


More information about the Python-bugs-list mailing list