[Python-ideas] Nested with statements

Arnaud Delobelle arnodel at googlemail.com
Mon Apr 27 21:54:58 CEST 2009

On 27 Apr 2009, at 20:33, Mattias Brändström wrote:
> It would be really useful to have a shorthand for creating truly
> nested with statements. My idea then is this: couldn't the language be
> tweaked to handle this? It might look something like this:
> with A(), B() as a,b:
>    # Code that uses a and b.
> This would translate directly to:
> with A() as a:
>    with B() as b:
>        # Code that uses a and b.

There was a discussion about this on this list:


I can't remember the outcome.


More information about the Python-ideas mailing list