Skip to content

Instantly share code, notes, and snippets.

@earthboundkid
Created September 19, 2013 18:39
Show Gist options
  • Save earthboundkid/6627945 to your computer and use it in GitHub Desktop.
Save earthboundkid/6627945 to your computer and use it in GitHub Desktop.
>>> 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
Copy link

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