[Python-Dev] Mutable sequence .sort() signature

Guido van Rossum guido at python.org
Wed Feb 13 21:14:33 CET 2008


On Feb 13, 2008 12:09 PM, Daniel Stutzbach
<daniel at stutzbachenterprises.com> wrote:
> Without the cmp argument, what's the concise way to spell something like
> "sort a list of floats by absolute value"?  It'd be nice to have a stock
> example to help users rewrite their code to work with 3.0.

L.sort(key=abs)

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list