Finally found a use for lambda!
andrew-pythonlist at puzzling.org
Mon Sep 15 11:54:49 CEST 2003
On Mon, Sep 15, 2003 at 01:33:06AM -0700, Hannu Kankaanp?? wrote:
> Roy Smith <roy at panix.com> wrote in message news:<roy-FFBAC5.22283914092003 at reader2.panix.com>...
> > so I guess I didn't really need the lambda after all :-)
> Lambda is pretty useless in Python, unfortunately. List comprehensions
> reduce their uses with filter and map, and any more complex closure
> has to be written as a named function anyway.. I wish lambda would
> allow statements in them also, so I could do
> func(lambda x: arr[x] = y)
Well, you *could* do func(lambda x: arr.__setitem__(x, y)). But you
probably shouldn't ;)
More information about the Python-list