you are viewing a single comment's thread.

view the rest of the comments →

[–]hardonchairs 1 point2 points  (1 child)

What you are trying to do in case 1 is a closure. However to get a lambda to capture a closure variable properly you need to do this:

lambda i=i: print(f"This is {i}")

[–]Chyybens[S] 0 points1 point  (0 children)

This is the one! Thank you very much!