It is easy to save function into a variable like
pr = print
pr(5) # 5
But if this possible to save function with arguments without a call, like
some_var = defer print(5) # No call!
some_var() # 5
I tried to use lambda, but it's lead to syntaxys error `l = lambda 5:
Why I need it? For example to no repeat multiple "if" branches:
example:
def foo()
l1 = lambda: 1
l2 = lambda: 2
if 1:
func = l1
elif 2:
func = l2
else:
func = some_outer_func, some_inner_func
return func # To use "func" need additional "if" branches for type and length of a returned value