[Python-ideas] cmp and sorting non-symmetric types
Guido van Rossum
guido at python.org
Wed Nov 14 20:18:14 CET 2007
On Nov 14, 2007 11:03 AM, Adam Olsen <rhamph at gmail.com> wrote:
> On Nov 14, 2007 11:54 AM, Guido van Rossum <guido at python.org> wrote:
> > On Nov 14, 2007 10:47 AM, Adam Olsen <rhamph at gmail.com> wrote:
> > > On Nov 14, 2007 10:54 AM, Guido van Rossum <guido at python.org> wrote:
> > > > Are you sure you're solving a real problem?
> > >
> > > I see it as part of a problem we've already decided to solve, by
> > > making types with no reasonable ordering raise TypeError.
> > I think we're reaching the land of diminishing returns though.
> Aye. If we don't want to readd __cmp__ for other reasons then it's
> not worthwhile. If we do readd __cmp__ then it's basically free.
That depends -- while __cmp__ may be faster to compare lists or
tuples, __lt__ is faster when comparing ints or strings.
> So the real question is if there's enough support behind __cmp__..
> which I kind of doubt at this point.
If nobody volunteers to help write a PEP at this point, I will have to
agree with that conclusion.
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-ideas