[Python-ideas] unpacking context managers in WITH statement
Michael Foord
fuzzyman at gmail.com
Fri Feb 3 19:09:56 CET 2012
On 3 February 2012 18:06, Yury Selivanov <yselivanov.ml at gmail.com> wrote:
> On 2012-02-03, at 12:50 PM, Michael Foord wrote:
>
> > with *ctxs as tuple_of_results:
>
> This is not necessary, as 'ctxs' already holds all instances of
> all context managers; so the 'ctxs' would be equal to 'tuple_of_results'
>
The results are whatever is returned by ctx.__enter__(), not the context
manager itself.
Michael
>
> > with *ctx, other as tuple_of_results, another:
> > ...
>
> Looks useful to me.
>
> -
> Yury
>
--
http://www.voidspace.org.uk/
May you do good and not evil
May you find forgiveness for yourself and forgive others
May you share freely, never taking more than you give.
-- the sqlite blessing http://www.sqlite.org/different.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20120203/98897afd/attachment.html>
More information about the Python-ideas
mailing list