4 ms·
Not really, since Python can nest functions: def something(x): def myfunc(y, z): ... return result reduce(myfunc, x) So the difference i
by stormking 8y ago
Not really, since Python can nest functions:
def something(x):
def myfunc(y, z):
...
return result
reduce(myfunc, x)
So the difference is like having to write
x = some_very_complex_expression_that_can_get_quite_long
some_function(x)
instead of
some_function(some_very_complex_expression_that_can_get_quite_long)
In many cases this may make code even more readable.
I'm not saying that Python's lambdas are perfect as they are or that multi-line lambdas would be a bad thing. I'm just saying it's not as bad as you paint it.