[Python-ideas] Allow parentheses to be used with "with" block

Ron Adam ron3200 at gmail.com
Mon Feb 16 04:46:29 CET 2015


On 02/15/2015 07:03 PM, Ron Adam wrote:
>
>
> On 02/15/2015 06:47 PM, Ben Finney wrote:
>> MRAB<python at mrabarnett.plus.com>  writes:
>>
>>> >For example, how do you distinguish between:
>>> >
>>> >     with (as a b):
>> That's ‘with (a as b):’, I think you mean.
>>
>>> >and:
>>> >
>>> >     with (a) as b:
>> Are we expecting those two to have different effects?
>
> Or should it be...
>
>      With a, c, e as b, d, f:
>
>
> This would be more in line with "=" and "in".  And you might be able to use
> an iterable to give a, c, and e. It's values.

Actually it would be the reverse of "=" and "in".  The names being bound to 
are on the  right instead of the left.

But this choice has already been discussed.  So it's not really an option 
today.

The problem I see with parentheses in this case is they are only used to 
avoid using the line continuation char.  They neither represent a tuple, or 
an expression.

Ron

























More information about the Python-ideas mailing list