[issue3913] compound_stmt syntax includes 'decorated'
report at bugs.python.org
Sat Sep 20 05:00:22 CEST 2008
Bruce Frederiksen <dangyogi at gmail.com> added the comment:
The grammar definitions in the Language Reference are _not_ just a
straight copy of the Grammar. They have been reworked. (I don't know
why, perhaps to make it easier to understand)?
So the Grammar defines funcdef and classdef _without_ decorators and
then has a separate definition for decorated funcdefs and classdefs
called 'decorated' that is another compound_stmt (along with funcdef and
classdef). (For Grammar, I'm looking at:
The Language Reference defines both funcdef and classdef _with_ optional
decorators, so the 'decorated' alternative for compound_stmt is no
longer required and should be deleted. The following links should take
you straight to the funcdef and classdef definitions in the Language
Now, I just also noticed that the Language Reference actually has two
definitions of funcdef. The second definition is 3 lines below the
first one and fails to include either the optional decorators or the new
["->" expression] option after the argument list. Should I report this
as another bug, or does this comment count. This second definition
should be deleted.
Also, the first definition of funcdef in the Language Reference has an
extraneous '?' character after the ["->" expression] which should also
be deleted. Should I report this as a separate bug too, or leave it, as
well, to this comment? (Sorry for asking whether to report these too, I
don't know how strict you guys are about keeping a record of everything).
There are many other places where the grammar defined in the Language
Reference is not a mirror copy of the Grammar (but is still an
equivalent grammar). In fact, this seems to be the rule, rather than
the exception. If you are unaware of this, you should examine the
grammar definitions in the Language Reference and compare them to the
Grammar yourself; or ask whoever is in charge of the Language Reference
document. I don't know why this was done, I'm just trying to point out
that the Language Reference document has some (minor) bugs in it that
are very easily fixed.
Benjamin Peterson wrote:
> Benjamin Peterson <musiccomposition at gmail.com> added the comment:
> The language reference is merely a explanation of the the Grammar, so I
> don't understand why you think it shouldn't be there. A 'decorated' node
> contains a 'classdef' or 'fundef'.
> Python tracker <report at bugs.python.org>
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list