Fate of lambda, Functional Programming in Python...
Bernhard Herzog
bh at intevation.de
Sat Aug 21 12:44:10 EDT 2004
Jeff Sandys <sandysj at juno.com> writes:
> How about this use of lambda?
> (from another post 'RE: How to sort this kind of list easily?' today)
[...]
> | Or if you want to sort only on your Id, use a lambda:
> | l.sort(lambda x,y: cmp(x[0],y[0]))
@l.sort
def sort_on_zeroth(x, y):
return cmp(x[0], y[0])
Gives a whole new meaning to decorate-sort-undecorate ;-)
Bernhard
--
Intevation GmbH http://intevation.de/
Skencil http://sketch.sourceforge.net/
Thuban http://thuban.intevation.org/
More information about the Python-list
mailing list