[Python-ideas] Multi Statement Lambdas

Andreas Winschu andrej.wins at gmail.com
Sun Oct 21 12:28:40 EDT 2018

A def function has to be named.

Wheres a lambda expression can be passed anonymously to any other function
as an argument.

*map(lambda x: x**2, array)*


*def powers2(x)*
*   x**2*
*map(powers2, array)*

Coming up with a name here is not needed, as the operation is expressive

Am So., 21. Okt. 2018 um 18:17 Uhr schrieb Anders Hovmöller <
boxed at killingar.net>:

> >  A powerful general purpose language should not limit itself to one
> statement in a closure.
> Nitpick on language: It doesn't. Lambdas are not the only way to do a
> closure.
> It's important to be precise when discussing these things.
> > Lets add mutli-statement lambdas to python either with just curly braces
> or with an indent based machine.
> Mostly it's just better with a function. Do you have some more compelling
> examples where you can't use a function smoothly?
> / Anders


Andreas Winschu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20181021/56d4ac18/attachment-0001.html>

More information about the Python-ideas mailing list