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)

vs 

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

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



Am So., 21. Okt. 2018 um 18:17 Uhr schrieb Anders Hovmöller <boxed@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


--
Gruß

Andreas Winschu