[Python-ideas] unpacking context managers in WITH statement
Yury Selivanov
yselivanov.ml at gmail.com
Mon Feb 6 21:08:50 CET 2012
Well, native syntax would be much useful, but ContextStack seems like
a decent workaround. Will it be included in the stdlib (py3.3)?
On 2012-02-04, at 1:22 AM, Nick Coghlan wrote:
> On Sat, Feb 4, 2012 at 1:09 AM, Yury Selivanov <yselivanov.ml at gmail.com> wrote:
>> As of now, without "nested" we have either option of reimplementing it, or to write lots of ugly code with nested 'try..except's. So the feature was taken out, but nothing replaced it.
>>
>> What do you think guys?
>
> I think you should try contextlib2 :)
>
> Specifically, ContextStack:
> http://contextlib2.readthedocs.org/en/latest/index.html#contextlib2.ContextStack
>
> Cheers,
> Nick.
>
> --
> Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Python-ideas
mailing list