Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
>>> funcs = []
>>> for i in range(10):
... def f(): return i
... funcs.append(f)
...
>>> [func() for func in funcs]
[9, 9, 9, 9, 9, 9, 9, 9, 9, 9]
@ctbarna

This comment has been minimized.

Copy link

@ctbarna ctbarna commented Sep 19, 2013

Javascript sucks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.