Fate of lambda, Functional Programming in Python...

Dan Schmidt dfan at harmonixmusic.com
Sat Aug 21 18:02:46 CEST 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]))

In 2.4, you actually don't need a lambda:

   l.sort( key = operator.itemgetter( 0 ) )

but I too would be very sad to see anonymous functions go away,
although I find the current syntax pretty ugly.



More information about the Python-list mailing list