[Python-3000] self-contained exceptions
Nick Coghlan
ncoghlan at gmail.com
Thu Jan 11 15:37:46 CET 2007
Phillip J. Eby wrote:
> At 07:47 AM 1/10/2007 -0800, Guido van Rossum wrote:
>> BTW perhaps we should add the same semantics and syntax to 'with expr
>> as var'? I can't think of a reasonable use case
> [snip]
>> ... for using anything
>> more complex than a local variable, BTW.)
>
> with multi(ctx1, ctx2, ...) as var1, var2, ...:
>
> (if multi is a function that returns a context manager wrapping the other
> contexts and returning the tuple their __enter__ values).
...a utility which is also known as contextlib.nested().
For some strange reason, I suspect you're familiar with that particular
context manager ;)
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
---------------------------------------------------------------
http://www.boredomandlaziness.org
More information about the Python-3000
mailing list