Sorting (not Python-specific)

Michael Hudson mwh at
Wed Oct 31 10:57:13 CET 2001

Marcin 'Qrczak' Kowalczyk <qrczak at> writes:

> What are advantages and disadvantages in parametrizing sorting
> either by '<' or by the 3-way comparison?

I'm not *quite* sure what you mean, but if you're asking why list.sort
only relies on x<y rather than the whole cmp(x, y), I'm pretty sure
it's to stop insane __cmp__ methods causing infinite loops (no, I
don't know why this helps, but I've never thought about it that hard).


3. Syntactic sugar causes cancer of the semicolon.
  -- Alan Perlis,

More information about the Python-list mailing list