New submission from Christoph Reiter <reiter.christ...@gmail.com>:

I don't know if the bug tracker is the right place for this, please point me to 
the right place if not.

Someone faced to the following code (simplified example here) and asked for 
help:

```
if 3:
    if 1:
        print(((123))

if 2:
    print(123)
```

This results in the following error:

```
File "error.py", line 5
  if 2:
      ^
SyntaxError: invalid syntax
```

which is very confusing to users not familiar with generator expressions.

I'm wondering if python could improve syntax errors in this case by adding more 
context, like point to where it started parsing the current thing and where it 
gave up instead to just the later.

----------
messages: 382566
nosy: lazka
priority: normal
severity: normal
status: open
title: Unhelpful syntax error when expression spans multiple lines
versions: Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue42577>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to