[Python-ideas] If I had the time machine for comparisons

Jim Jewett jimjjewett at gmail.com
Thu Oct 13 16:06:32 CEST 2011


On Wed, Oct 12, 2011 at 11:18 PM, Guido van Rossum <guido at python.org> wrote:

> (I'm also -1 on adding ordering comparisons; there's little
> disagreement on that issue.)

If I had a time machine, I would allow comparisons to return
"unordered" as well.  Right now, objects are comparable or not based
strictly on the type, even though comparison is inherently about the
values.

I think that

    range(3) < range(10)

is obviously true, even though it isn't clear whether or not

    range(3, 15, 2) < range(7, -8, -1)

is true.

Here we err by not allowing the first comparison; other objects (like
dicts) we err by forcing an arbitrary ordering.

-jJ



More information about the Python-ideas mailing list