[Python-ideas] unpacking context managers in WITH statement
Nick Coghlan
ncoghlan at gmail.com
Sat Feb 4 07:22:48 CET 2012
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