[issue2603] Make range __eq__ work

Alexander Belopolsky report at bugs.python.org
Sat Apr 26 01:35:13 CEST 2008


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

On Fri, Apr 25, 2008 at 7:10 PM, Guido van Rossum
<report at bugs.python.org> wrote:
..
>  I think I'd be okay with normalization on creation, so that range(0,
>  5, 2) returns range(0, 6, 2). Hm, but isn't that odd? Why not the
>  other way around?

I find it natural to have start + len*step  = stop invariant rather
than start +(len-1)*step + 1 = stop.  I may be influenced by C++ (STL)
tradition of giving preference to "i != stop" over "i < stop"
condition so that algorithms support iterators that are not ordered.
I also believe some algorithmic simplifications will be possible with
 start + len*step  = stop invariant.

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


More information about the Python-bugs-list mailing list