Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compound_stmt syntax includes 'decorated' #48163

Closed
dangyogi mannequin opened this issue Sep 20, 2008 · 6 comments
Closed

compound_stmt syntax includes 'decorated' #48163

dangyogi mannequin opened this issue Sep 20, 2008 · 6 comments
Assignees
Labels
docs Documentation in the Doc dir

Comments

@dangyogi
Copy link
Mannequin

dangyogi mannequin commented Sep 20, 2008

BPO 3913
Nosy @birkenfeld, @benjaminp

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/birkenfeld'
closed_at = <Date 2008-09-20.01:03:57.953>
created_at = <Date 2008-09-20.00:59:55.868>
labels = ['docs']
title = "compound_stmt syntax includes 'decorated'"
updated_at = <Date 2008-09-21.07:22:42.385>
user = 'https://bugs.python.org/dangyogi'

bugs.python.org fields:

activity = <Date 2008-09-21.07:22:42.385>
actor = 'georg.brandl'
assignee = 'georg.brandl'
closed = True
closed_date = <Date 2008-09-20.01:03:57.953>
closer = 'benjamin.peterson'
components = ['Documentation']
creation = <Date 2008-09-20.00:59:55.868>
creator = 'dangyogi'
dependencies = []
files = []
hgrepos = []
issue_num = 3913
keywords = []
message_count = 6.0
messages = ['73448', '73450', '73453', '73454', '73456', '73491']
nosy_count = 3.0
nosy_names = ['georg.brandl', 'dangyogi', 'benjamin.peterson']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue3913'
versions = ['Python 3.0']

@dangyogi
Copy link
Mannequin Author

dangyogi mannequin commented Sep 20, 2008

The python 3.0 Language Reference page describing compound_stmt
(http://docs.python.org/dev/3.0/reference/compound_stmts.html) includes
'decorated'. But the funcdef and classdef definitions both include
optional decorators. It looks like this 'decorated' option should be
deleted.

@dangyogi dangyogi mannequin assigned birkenfeld Sep 20, 2008
@dangyogi dangyogi mannequin added the docs Documentation in the Doc dir label Sep 20, 2008
@benjaminp
Copy link
Contributor

If you look at the real Grammar (in Grammar/Grammar), you will see that
this decorated is used in the grammar.

@dangyogi
Copy link
Mannequin Author

dangyogi mannequin commented Sep 20, 2008

But the real Grammar doesn't include decorators on funcdef and classdef,
while the Language Reference document does. So the 'decorated' option
is not needed in the Language Reference (and, indeed, doesn't even seem
to be defined there).

Benjamin Peterson wrote:

Benjamin Peterson <musiccomposition@gmail.com> added the comment:

If you look at the real Grammar (in Grammar/Grammar), you will see that
this decorated is used in the grammar.

----------
nosy: +benjamin.peterson
resolution: -> invalid
status: open -> closed


Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue3913\>


@benjaminp
Copy link
Contributor

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'.

@dangyogi
Copy link
Mannequin Author

dangyogi mannequin commented Sep 20, 2008

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\>


@birkenfeld
Copy link
Member

Bruce is right.

I fixed "decorated", the duplicate "funcdef" and the "?" in r66527 and
r66528.

Bruce, usually adding comments with more issues, especially if they are
so small, is fine; however, since they may be overlooked you're free to
open another bug after a time if no reaction happens.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir
Projects
None yet
Development

No branches or pull requests

2 participants