This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pablogsal
Recipients aroberge, lys.nikolaou, pablogsal
Date 2021-11-13.20:00:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1636833621.54.0.493713798186.issue45801@roundup.psfhosted.org>
In-reply-to
Content
I think this is correct because if you add a comma, indeed is valid syntax:

>>> sum,[i for i in [1, 2, 3] if i%2==0]
(<built-in function sum>, [2])

Here the problem is that you are mentally mapping the construct to sum(...) where the parens are substituted with brackets, which is not what the parser sees, the parser sees two expressions glued together like

>> f() g()
  File "<stdin>", line 1
    f() g()
    ^^^^^^^
SyntaxError: invalid syntax. Perhaps you forgot a comma?

and it surrounds the whole expression. 

Do you have an idea on what you would prefer here? Otherwise, I suggest to close as "not a bug".
History
Date User Action Args
2021-11-13 20:00:21pablogsalsetrecipients: + pablogsal, aroberge, lys.nikolaou
2021-11-13 20:00:21pablogsalsetmessageid: <1636833621.54.0.493713798186.issue45801@roundup.psfhosted.org>
2021-11-13 20:00:21pablogsallinkissue45801 messages
2021-11-13 20:00:21pablogsalcreate