[New-bugs-announce] [issue30577] Multidimensional comprehensions cannot access class variables except in the first for
Fengyang Wang
report at bugs.python.org
Mon Jun 5 19:56:16 EDT 2017
New submission from Fengyang Wang:
Reduced reproduction:
class X:
r = [1, 2, 3]
z = [(i, j) for i in [4, 5] for j in r]
fails with "NameError: name 'r' is not defined". The expected behavior would be for r to be resolved as the r in the class namespace. Note in contrast that
class Y:
r = [1, 2, 3]
z = [(i, j) for j in r for i in [4, 5]]
does not fail.
(Version 3.5.2 on Windows)
----------
components: Interpreter Core
messages: 295220
nosy: fengyang.wang
priority: normal
severity: normal
status: open
title: Multidimensional comprehensions cannot access class variables except in the first for
type: behavior
versions: Python 3.5
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30577>
_______________________________________
More information about the New-bugs-announce
mailing list