I am having difficulty in understanding the lambda function syntax in python. In particular, I don't understand why the following code shouldn't work:
def f(x):
return lambda x:x**2
f(2)
The output that I expect is 4 but the actual output looks like this:
<function __main__.<lambda>>
What is going on? Thanks in advance
f(2). If your looking for currying use functools.partial.