[issue14972] listcomp with nested classes

2012-06-01 Thread Florent Xicluna
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:

[issue14972] listcomp with nested classes

2012-05-31 Thread josmiley
New submission from josmiley joel-murie...@sfr.fr: # this runs with python2.7, not with python3.2 class Foo(object): class Bar(object): pass Attr = [Bar()for n in range(10)] # solved in this way ... class Foo(object): class Bar(object): pass Attr = [] for

[issue14972] listcomp with nested classes

2012-05-31 Thread Florent Xicluna
Florent Xicluna florent.xicl...@gmail.com added the comment: Simpler test case: class A: x = 42 y = [x for _ in '1'] The semantics of list comprehension changed with Python 3. However, I do not see this specific behavior documented somewhere.

[issue14972] listcomp with nested classes

2012-05-31 Thread Alex Gaynor
Changes by Alex Gaynor alex.gay...@gmail.com: -- nosy: +alex ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14972 ___ ___ Python-bugs-list mailing

[issue14972] listcomp with nested classes

2012-05-31 Thread Westley Martínez
Westley Martínez aniko...@gmail.com added the comment: $ python Python 3.2.3 (default, Apr 23 2012, 23:35:30) [GCC 4.7.0 20120414 (prerelease)] on linux2 Type help, copyright, credits or license for more information. class A: ... x = 42 ... y = [x for _ in '1'] ... Traceback (most

[issue14972] listcomp with nested classes

2012-05-31 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: This is doubtless a result of the way the class namespace scope is handled, coupled with the fact that in Python3 list comprehensions have a local scope. The class scope is a somewhat unique beast. I agree that this is unfortunate,

[issue14972] listcomp with nested classes

2012-05-31 Thread Hynek Schlawack
Changes by Hynek Schlawack h...@ox.cx: -- nosy: +hynek ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14972 ___ ___ Python-bugs-list mailing list