[Python-Dev] Re: Re: lists v. tuples
Sat, 15 Mar 2003 12:54:05 -0500
"Guido van Rossum" <email@example.com> wrote in message
> But the order isn't meaningful.
> If I had to do it over again, I'd only implement == and != for
> of vastly differing types, and limit <, <=, >, >= to objects that
> meaningfully comparable.
For user-defined types/classes, I presume that this would still mean
deferring to the appropriate magic method (__cmp__ or __ge__?) to
> I'd like to to this in Python 3.0, but that probably means we'd have
> to start deprecating default comparisons except (in)equality in
+1, I think.
Based on reading cl.py, the validity of nonsense comparisons is one of
the more surprising 'features' of Python for beginners -- who
reasonably expect a TypeError or ValueError. Once they get past that,
they are then surprised by the unstability across versions. Given
that universal sorting of hetero-lists is now broken, I think it would
be better to do away with it cleanly. It is seldom needed and would
still be available with a user-defined sorting function (which
requires some thought as to what is really wanted). A Python version
of the present algorithm could be included (in Tools/xx perhaps) for
anyone who actually needs it.
Terry J. Reedy