[Python-ideas] Implement comparison operators for range objects
Ethan Furman
ethan at stoneleaf.us
Thu Oct 13 00:57:53 CEST 2011
Guido van Rossum wrote:
> I beg to differ with all those who want range(0, 10, 2) == range(0,
> 11, 2).
I think practicality should beat purity here -- if the same results will
be generated, then the ranges are the same and should be equal, no
matter which exact parameters were used to create them.
> After all the repr() shows the end point that was requested,
> not the end point after "normalization" (or whatever you'd call it) so
> the three parameters that went in should be considered state.
>
> OTOH range(10) == range(0, 10) == range(0, 10, 1).
Exactly.
~Ethan~
More information about the Python-ideas
mailing list