[New-bugs-announce] [issue37632] generator expression doesn't find subclass
Ákos Tompos
report at bugs.python.org
Fri Jul 19 11:28:48 EDT 2019
New submission from Ákos Tompos <akos.brain at gmail.com>:
The following code does work on python 2.7 but fails on python 3.7. The code seems correct.
class A:
class B:
def __init__(self, param):
self.param = param
l = [B(i) for i in range(10)]
The result on:
3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)]
Traceback (most recent call last):
File "test.py", line 6, in <module>
class A:
File "test.py", line 11, in A
l = [B(i) for i in range(10)]
File "test.py", line 11, in <listcomp>
l = [B(i) for i in range(10)]
NameError: name 'B' is not defined
B can be accessed if not inside a generator expression
----------
messages: 348181
nosy: Ákos Tompos
priority: normal
severity: normal
status: open
title: generator expression doesn't find subclass
versions: Python 3.7
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37632>
_______________________________________
More information about the New-bugs-announce
mailing list