Let's say we have a basic function:
def basic(arg):
print arg
We need to defer the evaluation of this function in another function. I am thinking about 2 possible ways:
Using lambdas:
def another(arg): return lambda: basic(arg)
Using functools.partial
from functools import partial def another(arg): return partial(basic, arg)
Which of these approaches is preferred and why? Is there another way of doing this?