by InfamousRece · 3y ago · 0 comments
funcs.append(lambda i=i: print(i))Maybe this example where it returns the closures from a function is convincing?
def fs():
funcs = list()
for i in range(10):
funcs.append(lambda: print(i))
return funcs
for f in fs():
f()