4 ms·
I don't understand the argument either.. I use multi-line lambdas with ifs and forloops all the time. f = lambda x:( x if ( x**2 > 10 or x**2 < 5
by brutimus 17y ago
I don't understand the argument either.. I use multi-line lambdas with ifs and forloops all the time.
f = lambda x:(
x if (
x**2 > 10 or x**2 < 5
)
else x**3
)
- cturner 17y agoI don't think you can assign variables in these blocks, nor do sequential statements. Imagine you wanted to reduce a list, and then do something on it. Print statements don't work either.