[issue12782] Multiple context expressions do not support parentheses for continuation across lines

Łukasz Langa report at bugs.python.org
Fri Sep 28 09:50:45 EDT 2018


Łukasz Langa <lukasz at langa.pl> added the comment:

This was closed without enough explanation. Suggesting people should use ExitStack due to a Python grammar deficiency is suboptimal to say the least.

This problem is coming back to users of Black due to Black's removal of backslashes. It's the only piece of our grammar where backslashes are required for readability which shows there's something wrong.

The syntax ambiguity that Nick is raising fortunately shouldn't be a problem because a single tuple is an invalid context manager. In other contexts if the organizational parentheses are matched by the with-statement and not by the underlying `test`, that's also fine since they were organizational this doesn't make the `test` invalid.

Pablo has a working patch for this, we intend to fix this wart for Python 3.8.

----------
nosy: +lukasz.langa
resolution: wont fix -> 
stage:  -> patch review
status: closed -> open
versions: +Python 3.8 -Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue12782>
_______________________________________


More information about the Python-bugs-list mailing list