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.

Title: Inclusion or documentation of extended with syntax in 3.9
Type: Stage: resolved
Components: Documentation, Interpreter Core Versions: Python 3.9
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: docs@python Nosy List: asmeurer, davidhalter, docs@python
Priority: normal Keywords:

Created on 2020-08-08 01:32 by asmeurer, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 19503 asmeurer, 2020-08-08 01:31
Messages (2)
msg375029 - (view) Author: Aaron Meurer (asmeurer) Date: 2020-08-08 01:31
This discussion started at (actually on Twitter, 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

It also apparently goes against PEP 627, 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.
msg375062 - (view) Author: David Halter (davidhalter) Date: 2020-08-08 22:41
I second this. I just see people complaining about this not working in a lot of tools. This is really not necessary for a feature that should not be used anyway and puts work onto the greater Python ecosystem for no good reason.
Date User Action Args
2022-04-11 14:59:34adminsetgithub: 85678
2021-04-16 11:46:18pablogsalsetstatus: open -> closed
resolution: out of date
stage: resolved
2021-03-26 15:07:52iritkatrielsetassignee: docs@python

components: + Documentation, Interpreter Core
nosy: + docs@python
2020-08-08 22:41:01davidhaltersetmessages: + msg375062
2020-08-08 22:38:29davidhaltersetnosy: + davidhalter
2020-08-08 01:32:00asmeurercreate