Sorting using lambda not working in Py2.1?

Paul Jackson pj at sgi.com
Fri May 4 20:57:04 EDT 2001


|> What do you mean by stable in this case?

Presumably he means that two elements that compare equal will
preserve their relative order after the sort.

That is, say you are sorting ("c", "b2", "a", "b1") comparison
that simply compares the first character, then if the sort is
stable, you can count on the result being ("a", "b2", "b1",
"c"), not ("a", "b1", "b2", "c"), because "b2" comes before
"b1" in the input.

(But I have this suspicion that you knew that already and that
I've just made a fool of myself by missing your real question
... oh well ...).
-- 

                          I won't rest till it's the best ...
                          Manager, Linux System Software
                          Paul Jackson <pj at sgi.com> 1.650.933.1373



More information about the Python-list mailing list