[Python-ideas] unpacking context managers in WITH statement

Alexander Heger python at 2sn.net
Sat Feb 4 23:12:53 CET 2012


> Well, I quite like this syntax and it does allow you to do something not
> currently easily possible:
>
> with *ctxs as tuple_of_results:
>     ...
>
> The use case is reasonably obscure however, and should this be possible:
>
> with *ctx, other as tuple_of_results, another:

wouldn't it be

with *ctx, other as *tuple_of_results, another:

to allow more general forms like

with *ctx, other as first, *some_in_the_middle, last:

-Alexander



More information about the Python-ideas mailing list