New submission from kai zhu <[EMAIL PROTECTED]>: in 3rd line, list comprehension tries to access class_attribute1 as a global variable (code is valid in python 2.5)
>>> class Foo(object): ... class_attribute1 = 1 ... class_attribute2 = [class_attribute1 for x in range(8)] ... Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<stdin>", line 3, in Foo File "<stdin>", line 3, in <listcomp> NameError: global name 'class_attribute1' is not defined ---------- components: Interpreter Core messages: 72002 nosy: kaizhu severity: normal status: open title: improper scope in list comprehension, when used in class declaration type: behavior versions: Python 3.0 _______________________________________ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3692> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com