[Python-3000] Change to class construction? (original) (raw)

Collin Winter collinw at gmail.com
Fri Jul 6 16:03:56 CEST 2007


While experimenting with porting setuptools to py3k (as of r56155), I ran into this situation:

class C: a = (4, 5) b = [c for c in range(2) if a]

results in a "NameError: global name 'a' is not defined" error, while

class C: a = (4, 5) b = [c for c in a]

works fine. This gives the same error as above:

class C: a = (4, 5) b = [a for c in range(2)]

Both now-erroneous snippets work in 2.5.1. Was this change intentional?

Collin Winter



More information about the Python-3000 mailing list