Sorting (not Python-specific)
mwh at python.net
Wed Oct 31 10:57:13 CET 2001
Marcin 'Qrczak' Kowalczyk <qrczak at knm.org.pl> 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, http://www.cs.yale.edu/homes/perlis-alan/quotes.html
More information about the Python-list