Create a gist now

Instantly share code, notes, and snippets.

>>> 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