3 ms·
> Functions are first-class objects. If you want a multi-line lambda thats just a function. Yes, lambdas are just anonymous functions that are restricted to a
by dragonwriter 4y ago
> Functions are first-class objects. If you want a multi-line lambda thats just a function.
Yes, lambdas are just anonymous functions that are restricted to a single expression, no statements. This is a problem for programming in functional style, because python idiomatically uses statements a lot, and doing a named definition for a single use function is more verbose and less readable in mant cases.
- maxbond 4y agoMy stylistic advice in that case would be to name it _lambda() (note the underscore that solves keyword issues). Though I don't disagree.