[issue11796] Comprehensions in a class definition mostly cannot access class variable

2015-10-29 Thread Anne Rosa Wangnick
Anne Rosa Wangnick added the comment: With https://bugs.python.org/issue13557 closed, this one should be reopened to amend 6.2.8 Generator expressions: "[However, the leftmost for clause is immediately evaluated] (in the local context)[, so that an error produced by it can be seen ...]" -

[issue11796] Comprehensions in a class definition mostly cannot access class variable

2012-07-07 Thread Florent Xicluna
Florent Xicluna added the comment: It looks as a duplicate of issue 13557. I close this one, because a doc patch is attached on the other. -- resolution: -> duplicate status: open -> closed superseder: -> exec of list comprehension fails on NameError _

[issue11796] Comprehensions in a class definition mostly cannot access class variable

2012-06-01 Thread Florent Xicluna
Changes by Florent Xicluna : -- nosy: +anikom15, flox, josmiley ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue11796] Comprehensions in a class definition mostly cannot access class variable

2011-04-09 Thread Michael Foord
Changes by Michael Foord : -- nosy: +michael.foord ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.

[issue11796] Comprehensions in a class definition mostly cannot access class variable

2011-04-09 Thread Menno Smits
Menno Smits added the comment: Thanks to everyone for the explanations. I was hoping for behaviour along the lines of Python 2 (certainly not artificially blocking more cases in the name of consistency) but it doesn't look like that's going to happen. I think this is one slight and rare area

[issue11796] Comprehensions in a class definition mostly cannot access class variable

2011-04-08 Thread Terry J. Reedy
Terry J. Reedy added the comment: Thanks. I remember now: the initial iter_exp is evaluated immediately because it always *can* be, because it is only evaluated once and can only involve 'outside' names, whereas the result expression and any conditional expressions and further iteration expre

[issue11796] Comprehensions in a class definition mostly cannot access class variable

2011-04-08 Thread Raymond Hettinger
Raymond Hettinger added the comment: > Devs are aware that there is an exception to the general rule > for the 'for' clause. There is a technical reason why the > exception is possible, though I have forgotten it. It is best understood when thinking about a gexexp that gets run long after is

[issue11796] Comprehensions in a class definition mostly cannot access class variable

2011-04-08 Thread Terry J. Reedy
Terry J. Reedy added the comment: Title changed. Generator expressions had the same limitation in 2.x. All comprehensions have the same limitation in 3.x. -- title: list and generator expressions in a class definition fail if expression condition refers to a class variable -> Comprehen