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

[Python-Dev] 2.4a2, and @decorators

[Python-Dev] 2.4a2, and @decorators [Python-Dev] 2.4a2, and @decoratorsGuido van Rossum guido at python.org
Tue Aug 3 03:05:15 CEST 2004
> The one thing I do dislike about the new addition is the arbitrary (?) 
> restriction on expression allowed in a decorator. From Grammar..
>    decorator: '@' dotted_name [ '(' [arglist] ')' ]
> That seems quite odd to me. Is there some reason it couldn't be:
>    decorator: '@' test
> ?

The first patch on SF actually had '@' test, and I requested that it
be changed.  Most things that are 'test' but not 'dotted_name'
optionally followed by an argument list don't make sense as
decorators; if you really have a need to write

    @ foo or bar
    def f(): ...

you can write

    deco = foo or bar
    @deco
    def f(): ...

--Guido van Rossum (home page: http://www.python.org/~guido/)
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