Sorting (not Python-specific)
Michael Hudson
mwh at python.net
Wed Oct 31 04:57:13 EST 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).
Cheers,
M.
--
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
mailing list