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

Ben Finney ben+python at benfinney.id.au
Mon Feb 16 00:35:26 CET 2015


Neil Girdhar <mistersheik at gmail.com>
writes:

> 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

And even the more consistent::

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

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

+1. It frequently surprises me that this isn't already legal syntax, and
I'd very much like to see this improvement.

-- 
 \        “Somebody told me how frightening it was how much topsoil we |
  `\   are losing each year, but I told that story around the campfire |
_o__)                             and nobody got scared.” —Jack Handey |
Ben Finney



More information about the Python-ideas mailing list