About the grammar

franck pommereau at univ-paris12.fr
Mon Apr 19 03:05:42 EDT 2010


> >     argument: ... | test '=' test
> Where are you finding that?

This comes from Python-2.6/Grammar/Grammar in the source distribution.

> This tells you that keyword arguments cannot have keywords that aren't
> identifiers:
>
> >>> sum(1=2)
>
>   File "<stdin>", line 1
> SyntaxError: keyword can't be an expression

Sure! So my surprise.

But Martin did provide a very good explanation that this form in the
grammar actually allows to avoid an ambiguity.

Cheers,
Franck



More information about the Python-list mailing list