Closures/Value capture: Difference between revisions
Content deleted Content added
Line 624:
print funcs[3]() # prints 9</lang>
It is also possible to use <code>eval</code>
<lang python>funcs=[eval("lambda:%s"%i**2)for i in range(10)]
print funcs[3]() # prints 9</lang>
|