This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author dangyogi
Recipients benjamin.peterson, dangyogi, georg.brandl
Date 2008-09-20.03:00:20
SpamBayes Score 1.6653345e-16
Marked as misclassified No
Message-id <48D46646.2010505@gmail.com>
In-reply-to <1221876787.77.0.858880655149.issue3913@psf.upfronthosting.co.za>
Content
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: 
http://docs.python.org/dev/3.0/reference/grammar.html).

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 
Reference:

http://docs.python.org/dev/3.0/reference/compound_stmts.html#grammar-token-funcdef
http://docs.python.org/dev/3.0/reference/compound_stmts.html#grammar-token-classdef

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@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@bugs.python.org>
> <http://bugs.python.org/issue3913>
> _______________________________________
>
>
History
Date User Action Args
2008-09-20 03:00:22dangyogisetrecipients: + dangyogi, georg.brandl, benjamin.peterson
2008-09-20 03:00:21dangyogilinkissue3913 messages
2008-09-20 03:00:20dangyogicreate