About the grammar

franck pommereau at univ-paris12.fr
Mon Apr 19 02:29:44 EDT 2010


Dear all,

I'm wondering why in Python's grammar, keyword arguments are specified
as:

    argument: ... | test '=' test

I would have expected something like

    argument: ... | NAME '=' test

Indeed, I cannot imagine a case where the keyword is something else
than an identifier. Moreover, in the Python language reference (see
http://docs.python.org/reference/expressions.html#grammar-token-keyword_item)
one can read:

    keyword_item ::= identifier "=" expression

which is what I was expecting.

Does any one knows why the grammar is so coded? Any intuition?

Thanks in advance!
Franck



More information about the Python-list mailing list