[Python-ideas] Implement comparison operators for range objects

Sven Marnach sven at marnach.net
Fri Oct 14 20:16:09 CEST 2011


Guido van Rossum schrieb am Fr, 14. Okt 2011, um 10:23:10 -0700:
> - add slicing such that it normalizes .stop to .start + the right
> multiple of .step

That's what slicing already does now.  This kind of normalisation
still isn't enough to get an implementation of the sequence-based
definition of equality, though.  We would also need to set the step
value to 1 in case the range has length 0 or 1.  (Not that I'd propose
to do the latter -- I mention it just to make clear that the steps you
suggest don't allow for comparison of ranges as sequences in any
easier way than currently possible.)

Cheers,
    Sven



More information about the Python-ideas mailing list