[Python-ideas] Allow parentheses to be used with "with" block

Neil Girdhar mistersheik at gmail.com
Sun Feb 15 22:52:42 CET 2015


It's great that multiple context managers can be sent to "with":

with a as b, c as d, e as f:
     suite

If the context mangers have a lot of text it's very hard to comply with 
PEP8 without resorting to "\" continuations, which are proscribed by the 
Google style guide.

Other statements like import and if support enclosing their arguments in 
parentheses to force aligned continuations.  Can we have the same for 
"with"?

E.g.

with (a as b,
         c as d,
         e as f):
    suite

This is a pretty minor change to the grammar and parser.

Best,

Neil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150215/681e1f42/attachment.html>


More information about the Python-ideas mailing list