[Python-ideas] with-statement syntactic quirk

Steven D'Aprano steve at pearwood.info
Thu Nov 1 12:26:59 CET 2012


On 01/11/12 21:48, Antoine Pitrou wrote:

> Uh, what people seem to miss is that it's not only about nested context
> managers. It can happen with a single context manager:
>
> with (some_context_manager(many_arguments...)
>        as my_variable):
>      ...
>
> # SyntaxError!

Have I missed something?

with some_context_manager(
         many_arguments,
         and_more_arguments,
         and_still_more_arguments
         ) as my_variable:
     ...


I'm still not seeing a problem that needs fixing.


-- 
Steven



More information about the Python-ideas mailing list