[Python-ideas] Implement comparison operators for range objects

Mark Dickinson dickinsm at gmail.com
Wed Oct 12 19:58:25 CEST 2011


On Wed, Oct 12, 2011 at 6:33 PM, Steven D'Aprano <steve at pearwood.info> wrote:
> I don't agree. Equality makes sense for ranges: two ranges are equal if they
> have the same start, stop and step values.

Hmm.  I'm not sure that it's that clear cut. The other possible
definition is that two ranges are equal if they're equal as lists.

Should range(0, 10, 2) and range(0, 9, 2) be considered equal, or not?


Agreed that it makes more sense to implement equality for ranges than
the order comparisons.


Mark



More information about the Python-ideas mailing list