[Python-Dev] Re: Re: lists v. tuples (original) (raw)

Guido van Rossum guido@python.org
Sat, 15 Mar 2003 17:45:34 -0500


[Terry Reedy]

For user-defined types/classes, I presume that this would still mean deferring to the appropriate magic method (cmp or ge?) to define 'meaningful'.

Yes. And I'm still hoping to remove cmp; there should be only one way to overload comparisons.

> 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 Python > 2.4.

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

Exactly.

A Python version of the present algorithm could be included (in Tools/xx perhaps) for anyone who actually needs it.

I doubt there will be many takers. Let people make up their own version, so they know its behavior.

--Guido van Rossum (home page: http://www.python.org/~guido/)