I wanted to return a lambda expression from a function if the argument to the function fulfills some criteria. I thought by writing something like the following this can be done:
def f(x=None):
return x or lambda:True
f()
but the call raises a syntax error! Saving the lambda in a lexical variable does the work, but I am curious why is it not possible to write the expression above?