New submission from Pablo Galindo Salgado <pablog...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue43823>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to