[Python-Dev] funcdef grammar production
Jewett, Jim J
jim.jewett at eds.com
Wed Mar 17 10:00:45 EST 2004
Michael Hudson:
>> PEP 318 is likely to change the BNF productions for funcdef,
>> so I was taking a look at what is there right now.
> Um, you do realise that this BNF is purely documentational?
I realize that documentation is purely documentational.
I didn't understand why this particular rule [all keywords
arguments after all purely positional arguments] was left
out of the pseudo-code and mentioned only in text. I also
wondered why the parameter_list rule was so long and convoluted;
one possible path is
(defparameter ",")* (defparameter [","])
In general, python documentation is either missing or very good.
If *this* was the best explanation, then there was a problem with
my mental model, and I wanted to know what I was missing. I
suggested possible reasons in an attempt to clarify my question.
Guido explained by correcting my assumptions about what had to
be unambiguous when. Under the current production,
"(a"
is ambiguous only over which defparameter (in the same production)
the "a" represents. Under my formulation, it would be ambiguous
whether "a" was a defparameter or a (regular) parameter, which are
different productions. Looking ahead for the "=" violates a
no-lookahead rule.
-jJ
More information about the Python-Dev
mailing list