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

Nikolaus Rath Nikolaus at rath.org
Mon Feb 16 18:57:07 CET 2015


On Feb 15 2015, Neil Girdhar <mistersheik-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org> wrote:
> with (a as b,
>          c as d,
>          e as f):
>     suite

As a side note, you can also use ExitStack to avoid having to use line
continuations:

with ExitStack() as cb:
    b = cb.push(a)
    d = cb.push(c)
    f = cb.push(e)

Way more characters to type, but it looks better than \.


Best,
-Nikolaus

-- 
GPG encrypted emails preferred. Key id: 0xD113FCAC3C4E599F
Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F

             »Time flies like an arrow, fruit flies like a Banana.«


More information about the Python-ideas mailing list