[New-bugs-announce] [issue43017] Improve error message in the parser when using un-parenthesised tuples in comprehensions

Pablo Galindo Salgado report at bugs.python.org
Sun Jan 24 13:00:46 EST 2021


New submission from Pablo Galindo Salgado <pablogsal at gmail.com>:

I have seen this confusion many users over the years. Instead of showing:

❯ python -c '[x,z for x,y in something]'
  File "<string>", line 1
    [x,z for x,y in something]
         ^
SyntaxError: invalid syntax

We can show:

❯ ./python -c '[x,z for x,y in something]'
  File "<string>", line 1
    [x,z for x,y in something]
     ^
SyntaxError: did you forgot parentheses around the comprehension target?

----------
messages: 385586
nosy: pablogsal
priority: normal
severity: normal
status: open
title: Improve error message in the parser when using un-parenthesised tuples in comprehensions

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43017>
_______________________________________


More information about the New-bugs-announce mailing list