[Python-ideas] Implement comparison operators for range objects

Guido van Rossum guido at python.org
Fri Oct 14 20:28:47 CEST 2011


On Fri, Oct 14, 2011 at 11:16 AM, Sven Marnach <sven at marnach.net> wrote:
> 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.

I guess I tested with an old version of Python 3...

> 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.)

Ok, so we don't have anything to do for slices. It doesn't change my
opinion on the rest.

-- 
--Guido van Rossum (python.org/~guido)



More information about the Python-ideas mailing list