0

[Question on Desc] Lambda vs def

Are the lambdas function are just a simpler way to write define function? Or there's more difference between them?

1st Feb 2020, 10:38 AM
Fevierce
Fevierce - avatar
1 ответ
+ 3
A lambda function can only contain one expression, so some calculation that immediately becomes the return value. So you have less flexibility with them. Mostly you use them in cases where you for example have to pass a function to another function, but you need it only this one time, and it's not too complicated.
1st Feb 2020, 10:45 AM
HonFu
HonFu - avatar