Skip to content

Instantly share code, notes, and snippets.

@multivac61
Created October 18, 2015 19:21
Show Gist options
  • Save multivac61/6e02f88b3a7816975d98 to your computer and use it in GitHub Desktop.
Save multivac61/6e02f88b3a7816975d98 to your computer and use it in GitHub Desktop.
'This is an example of list comprehension control variables being leaked to their outer scope'
for i in range(10):
a = [i for i in range(43)]
print i # will print 42 every time!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment