Andre Roberge <[email protected]> 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 <[email protected]>
<https://bugs.python.org/issue44447>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com