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 cryvate
Recipients benjamin.peterson, brett.cannon, cryvate, ncoghlan, serhiy.storchaka, yselivanov
Date 2017-11-13.15:19:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1510586390.34.0.213398074469.issue32012@psf.upfronthosting.co.za>
In-reply-to
Content
[As a follow-on, should I open a new issue/discuss on python-dev? Willing to help out with a solution on way or another! I know https://en.wikipedia.org/wiki/Wikipedia:Chesterton%27s_fence, "In my head" <> "Should be the case" etc. very much applies.]

In my head

    @...
    def foo(): pass

is equivalent to

    def _foo(): pass
    foo = ...()
    del _foo

However the following shows this is not the case:

    @0
    def foo(): pass

throws a syntax error, whereas

    def _foo(): pass
    foo = 0(_foo)

throws a type error. This might seem silly, but it is still unexpected.

https://docs.python.org/3/reference/compound_stmts.html#grammar-token-decorator has

    decorator ::= "@" dotted_name ["(" [argument_list [","]] ")"] NEWLINE

which in my head is

    decorator ::= "@" atom NEWLINE

Similarly for classes: https://docs.python.org/3/reference/compound_stmts.html#class-definitions

    inheritance ::= "(" [argument_list] ")"

which allows for keyword arguments (does that make any sense!?). In my head it is (compare with call: https://docs.python.org/3/reference/expressions.html#calls)

    inheritance ::= "(" [positional_arguments [","] | comprehension] ")"

[Tangentially related, this is how I originally got onto the mailing lists, my unhappiness with the definition of the for statement (https://docs.python.org/3/reference/compound_stmts.html#the-for-statement):

    for_stmt ::= "for" target_list "in" expression_list ":" suite ["else" ":" suite]

Which I would expect to be:

    for_stmt ::= comp_for ":" suite ["else" ":" suite]

so you could e.g. have if statements.
]
History
Date User Action Args
2017-11-13 15:19:50cryvatesetrecipients: + cryvate, brett.cannon, ncoghlan, benjamin.peterson, serhiy.storchaka, yselivanov
2017-11-13 15:19:50cryvatesetmessageid: <1510586390.34.0.213398074469.issue32012@psf.upfronthosting.co.za>
2017-11-13 15:19:50cryvatelinkissue32012 messages
2017-11-13 15:19:49cryvatecreate