A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2004-August/048042.html below:

[Python-Dev] PEP 318: Can't we all just get along?

[Python-Dev] PEP 318: Can't we all just get along?Phillip J. Eby pje at telecommunity.com
Thu Aug 19 06:43:40 CEST 2004
At 09:01 PM 8/18/04 -0700, Guido van Rossum wrote:
>Is anybody seriously trying to come up with a single alternative
>decorator proposal that most folks "out there" can support, to be
>presented to me (with implementation, please!) in time for 2.4b1?

I've been trying to drum up support here for option J4, a compromise 
between list-after-def and @decorators:

     def p_statement_expr(p)
        @staticmethod
        @grammarrule('statement : expression')
        @version("Added in 2.4")
        @returns(None)
    as:
        """Docstring could be here, or in the decorator part above"""
        # body goes here

I think it combines the best of several proposals; @definitions are more 
visible than list-after-def, but are not part of the function body, and you 
get to see the signature first.  It doesn't define a new keyword, "as" is 
an unambiguous pseudo-keyword here, because decorators start with "@".

The principal downside is the presence of indentation without either a : or 
enclosing brackets.  The syntax I proposed was something like:

     funcdef: "def" NAME arglist [decorators] ":" suite
     decorators: INDENT ("@" decorator_spec NEWLINE)* [docstring NEWLINE] 
DEDENT "as"

There's been no response that I've noticed, perhaps because by the time I 
proposed it people were already sick of looking at options A through 
J3.  :)  Or maybe it just sucks for some reason invisible to me.

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4