Eval makes expressions; they are not assigned.
>>> eval("lambda x,y: y*x")
<function <lambda> at 0xb73c779c>
>>> eval("lambda x,y: y*x")(2, 4)
8
You must assign the eval'd expression to the variable:
>>> mult = eval("lambda x,y: y*x")
>>> mult(2, 3)
6
source
share