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-June/045597.html below:

[Python-Dev] Re: decorators and 2.4

[Python-Dev] Re: decorators and 2.4 [Python-Dev] Re: decorators and 2.4Mark Russell marktrussell at btopenworld.com
Fri Jun 25 09:37:25 EDT 2004
On Wed, 2004-06-23 at 05:36, Guido van Rossum wrote:
>     @staticmethod
>     @funcattrs(vegetable="blag", author="GvR")
>     def blah2(args):
>         body
> 
> I would love to see an implementation of this idea.

OK, here's my stab at it: python.org/sf/979728

It's fairly minimal - I guess the biggest impact change is that funcdef
is now defined in Grammar/Grammer as:

     decorator: '@' test [NEWLINE]
     decorators: decorator+
     funcdef: [decorators] 'def' NAME parameters ':' suite

As this version of funcdef has an optional element at the beginning, I
changed the funcdef child node references (in compile.c and
parsermodule.c) to use a new macro RCHILD() which takes a negative index
and treats it as relative to the end of the node's children array.  

Mark Russell



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