This does not work:
print((lambda : return None)())
But this does:
print((lambda : None)())
Why?
Because return
is a statement. Lambdas can only contain expressions.
lambda
functions automatically return an expression. They cannot contain statements. return None
is a statement and therefore cannot work. None
is an expression and therefore works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With