[Python-ideas] Nested with statements

Mattias Brändström thebrasse at brasse.org
Mon Apr 27 22:28:39 CEST 2009


2009/4/27 Arnaud Delobelle <arnodel at googlemail.com>:
>
> 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:
>
> http://mail.python.org/pipermail/python-ideas/2009-March/003188.html
>
> I can't remember the outcome.
>

Oh. Thanks for pointing that out. I'll try and contribute to that
thread instead.

:.:: mattias



More information about the Python-ideas mailing list