[Python-ideas] Multi Statement Lambdas
boxed at killingar.net
Sun Oct 21 12:33:39 EDT 2018
> Wheres a lambda expression can be passed anonymously to any other function as an argument.
> map(lambda x: x**2, array)
> def powers2(x)
> map(powers2, array)
> Coming up with a name here is not needed, as the operation is expressive enough.
Sure, but there is a well known convention for such non-names already: meta syntactical variables. In this case the name could be "foo" and all readers will interpret this as "no name".
I admit to have wanted lambdas that are just as powerful as normal functions, but often when I want it the code is nicer when a normal function is used.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas