About the grammar
steven at REMOVE.THIS.cybersource.com.au
Mon Apr 19 02:52:23 EDT 2010
On Sun, 18 Apr 2010 23:29:44 -0700, franck wrote:
> Dear all,
> I'm wondering why in Python's grammar, keyword arguments are specified
> argument: ... | test '=' test
Where are you finding that?
> 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
> one can read:
> keyword_item ::= identifier "=" expression
> which is what I was expecting.
This tells you that keyword arguments cannot have keywords that aren't
File "<stdin>", line 1
SyntaxError: keyword can't be an expression
The only thing I can think of is that you're extrapolating from use cases
>>> def f(x):
... return x
But that's just a special case of this:
Of course, I could be completely misunderstanding what you mean.
More information about the Python-list