python 3: sorting with a comparison function

Kay Schluehr kay.schluehr at gmx.net
Fri Oct 10 08:35:18 EDT 2008


On 9 Okt., 22:36, bearophileH... at lycos.com wrote:

> Yes, that's a wonderful thing, because from the code I see around
> 99.9% of people see the cmp and just use it, totally ignoring the
> presence of the 'key' argument, that allows better and shorter
> solutions of the sorting problem.

Me too because I don't get this:

"key specifies a function of one argument that is used to extract a
comparison key from each list element: key=str.lower. The default
value is None."

Kay



More information about the Python-list mailing list