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 asmeurer
Recipients asmeurer
Date 2020-08-08.01:31:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1596850320.21.0.142080709573.issue41506@roundup.psfhosted.org>
In-reply-to
Content
This discussion started at https://github.com/python/cpython/pull/19503 (actually on Twitter https://twitter.com/asmeurer/status/1289304407696261120), but Guido asked me to move it bpo.

Alongside the implementation of Python 3.9's new PEG parser, a new syntax feature has been added, which is the ability to use parentheses in with statements, like

    with (open('a') as f1,
        open('b') as f2):
        ...

This is an error in lower versions of Python (or an error about tuple not having __enter__ if the "as" parts are omitted). 

This new feature is not documented in the "What's new in Python 3.9" document https://docs.python.org/3.9/whatsnew/3.9.html.

It also apparently goes against PEP 627 https://www.python.org/dev/peps/pep-0617/, which says (in bold), "no new Python Grammar addition will be added that requires the PEG parser".

Note that this feature does indeed rely on the PEG parser, and it stops working if you use python -X oldparser or PYTHONOLDPARSER=1.

I think this feature should either

1. be removed from 3.9 and held until 3.10, or
2. be documented properly, including in the document for the "with" statement and the "what's new" document. Also the PEP should be updated if this option is chosen.

Others have stated opinions about this on the issue or on Twitter, but I'll let them repeat them here rather than trying to summarize.
History
Date User Action Args
2020-08-08 01:32:00asmeurersetrecipients: + asmeurer
2020-08-08 01:32:00asmeurersetmessageid: <1596850320.21.0.142080709573.issue41506@roundup.psfhosted.org>
2020-08-08 01:32:00asmeurerlinkissue41506 messages
2020-08-08 01:31:59asmeurercreate