[Python-ideas] Reporting unmatched parentheses in SyntaxError messages?

Matthias Bussonnier bussonniermatthias at gmail.com
Wed Jul 8 16:19:27 CEST 2015


Hi, 

> On Jul 8, 2015, at 00:53, Nick Coghlan <ncoghlan at gmail.com> wrote:
> 
> 
>    File "/home/me/myfile.py", line 11
>        data = func()
>        ^
>    SyntaxError: invalid syntax (Unmatched '(' on line 10)
> 
> Or, similarly,
> 
>    SyntaxError: invalid syntax (Unmatched '[' on line 10)
>    SyntaxError: invalid syntax (Unmatched '{' on line 10)

That would be great !

In[1]: for i in range(10)
  ...:    print(i)
    
File "<ipython-input-9-8f028d5fd575>", line 1
    for i in range(10)
                      ^
SyntaxError: invalid syntax


Adding “Missing colon” here would be also super-helpful for education. 

Same for ifs, elses...
-- 
M



More information about the Python-ideas mailing list