Skip to content

Instantly share code, notes, and snippets.

@smarnach
Created March 2, 2012 01:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smarnach/1954605 to your computer and use it in GitHub Desktop.
Save smarnach/1954605 to your computer and use it in GitHub Desktop.
>>> class A(object):
... i = 3
... a = [i for x in range(3)]
...
>>> class A(object):
... i = 3
... a = list(i for x in range(3))
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 3, in A
File "<stdin>", line 3, in <genexpr>
NameError: global name 'i' is not defined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment