[issue44447] Syntax Error not as detailed as shown
Andre Roberge
report at bugs.python.org
Thu Jun 17 19:39:18 EDT 2021
Andre Roberge <andre.roberge at gmail.com> added the comment:
Your example is different than the one in the documentation (What's new).
>>> (x, x for x in range(7)) # Your example
File "<stdin>", line 1
(x, x for x in range(7))
^^^
SyntaxError: invalid syntax
>>> foo(x, x for x in range(7)) # Example similar to the docs
File "<stdin>", line 1
foo(x, x for x in range(7))
^^^^^^^^^^^^^^^^^^^
SyntaxError: Generator expression must be parenthesized
>>> [x, x for x in range(7)] # Yet a different example
File "<stdin>", line 1
[x, x for x in range(7)]
^^^^
SyntaxError: did you forget parentheses around the comprehension target?
----------
nosy: +aroberge
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44447>
_______________________________________
More information about the Python-bugs-list
mailing list