[New-bugs-announce] [issue43823] Improve syntax errors for invalid dictionary literals
Pablo Galindo Salgado
report at bugs.python.org
Mon Apr 12 22:05:47 EDT 2021
New submission from Pablo Galindo Salgado <pablogsal at gmail.com>:
Currently the error for invalid dict literals is generic:
>>> {1:2, 3:}
File "<stdin>", line 1
{1:2, 3:}
^
SyntaxError: invalid syntax
>>> {1:2, 3}
File "<stdin>", line 1
{1:2, 3}
^
SyntaxError: invalid syntax
We can have better errors for these cases, which can help with big dict literals:
>>> {1:2, 3}
File "<stdin>", line 1
{1:2, 3}
^
SyntaxError: ':' expected after dictionary key
>>> {1:2, 3:}
File "<stdin>", line 1
{1:2, 3:}
^
SyntaxError: expression expected after dictionary key and ':'
----------
messages: 390917
nosy: pablogsal
priority: normal
severity: normal
status: open
title: Improve syntax errors for invalid dictionary literals
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43823>
_______________________________________
More information about the New-bugs-announce
mailing list