[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[BUG] missing ')' causes syntax error on next line

On 23/07/2020 10:33, Chris Angelico wrote:
>> ---------- Forwarded message ---------
>> From: Jeff Linahan <jeff.linahan at>

>> See attached image.  Would be nice if it printed "SyntaxError: unbalanced
>> parens" as it can difficult to see the problem if code like this is run in
>> an environment that only prints the problematic line, which in this case
>> the compiler is confused and one line off.
> Thing is, the syntax error isn't the unbalanced parenthesis, because
> you can quite happily span multiple lines:

> But if you have a keyword inside there, it won't work:

> The parser can't figure out which one is wrong, so it simply reports
> the error at the point where it finds it. As a general rule, if you're
> pointed to a line that looks fine, try looking above it. (And that's
> not just for Python - many many programming languages exhibit this
> same behaviour, for the same reason.)

This may change when the new PEG-parser brings us Python 3.9 

I'm looking forward to seeing how this change will impact/improve the 
quality of feedback/traces/err.msgs...

OP: you may be interested in SuperHELP - Help for Humans!
Regards =dn