[Python-3000] self-contained exceptions

Phillip J. Eby pje at telecommunity.com
Thu Jan 11 17:18:02 CET 2007


At 12:37 AM 1/12/2007 +1000, Nick Coghlan wrote:
>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 ;)

Not that I recall, no, otherwise I'd have used the name.  I thought there 
was such a thing in the PEP, but didn't know it had gotten in the stdlib 
(which of course is an even better reason to keep tuple assignment in the 
"with" statement).



More information about the Python-3000 mailing list