New submission from Andre Roberge <andre.robe...@gmail.com>:

Python 3.10 and 3.11:

>>> sum[i for i in [1, 2, 3] if i%2==0]
  File "<stdin>", line 1
    sum[i for i in [1, 2, 3] if i%2==0]
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: invalid syntax. Perhaps you forgot a comma?

Furthermore, I don't find that highlighting the entire statement (or parts of 
it, if we use print(sum[...]) is very useful in attempting to find the source 
of the error.

In previous versions, we would get the following:

>>> sum[i for i in [1, 2, 3] if i%2==0]
  File "<stdin>", line 1
    sum[i for i in [1, 2, 3] if i%2==0]
          ^
SyntaxError: invalid syntax

----------
components: Parser
messages: 406287
nosy: aroberge, lys.nikolaou, pablogsal
priority: normal
severity: normal
status: open
title: Incorrect "Perhaps you forgot a comma" hint
versions: Python 3.10, Python 3.11

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

Reply via email to