[Python-Dev] Re: Re: lists v. tuples
Guido van Rossum
Sun, 16 Mar 2003 20:50:40 -0500
> > And I'm still hoping to remove __cmp__; there should be only one
> > way to overload comparisons.
> I'd rather you kept it and re-defined it to mean
> "compare for arbitrary ordering". (Maybe change its
> name if there are backwards-compatibility issues.)
Hm, that's not what it does now, and an arbitrary ordering is better
defined by a "less" style operator.
I've been thinking of __before__ and a built-in before(x, y) -> bool.
(Not __less__ / less, because IMO that's to close to __lt__ / <.)
BTW, there are two possible uses for before(): it could be used to
impose an arbitrary ordering for types that don't have one now (like
complex); and it could be used to impose an ordering between different
types (like numbers and strings). I've got a gut feeling that the
requirements for these are somewhat different, but can't quite
--Guido van Rossum (home page: http://www.python.org/~guido/)