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

MRAB python at mrabarnett.plus.com
Mon Feb 16 03:06:29 CET 2015


On 2015-02-16 01:33, Neil Girdhar wrote:
> Oh, hmm, I thought it would just be converting:
>
> with_stmt: 'with' with_item (',' with_item)*  ':' suite
>
> to
>
> with_stmt: 'with' ('(' with_item (',' with_item)* ')' | with_item (','
> with_item)*)  ':' suite
>
> but I guess that is ambiguous for a LL(1) parser.
>
> Well, maybe it's harder than I thought.  Someone better with grammars
> than me might know a nice way around this.
>
There might be a way around it, but it won't be nice! :-)



More information about the Python-ideas mailing list