Florent Xicluna <florent.xicl...@gmail.com> added the comment:

This is a duplicate of issue 11796.

See also issue 13557:
http://bugs.python.org/issue13557#msg154174

For Python 3, a list comprehension defines a block pretty much like the method 
definition during the class creation:

class x:
    x = 1
    def incx():
        return x + 1
    print(incx())

 ==> raises NameError too

----------
resolution:  -> duplicate
status: open -> closed
superseder:  -> Comprehensions in a class definition mostly cannot access class 
variable

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue14972>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to