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

[Python-Dev] Re: Call for defense of @decorators

[Python-Dev] Re: Call for defense of @decoratorsDelaney, Timothy C (Timothy) tdelaney at avaya.com
Fri Aug 6 01:48:29 CEST 2004
Shalabh Chaturvedi wrote:

>     |paramnames(username='Username', password='Password')
>     |webmethod(username=str, password=str)
>     def login(self, username, password, return_to=None):
>         request = current.request
>         ...
> 
>     |webmethod()
>     def logout(self, return_to=None):
>         current.request.session.user = None
>         return current.request.redirect(return_to or self._q_location)
> 
> Appears accentuated, yet clean, specially for simple/single
> decorators. 
> Gives an appearance that the decorators are 'connected' to the
> function. 

This looks remarkably nice to me for a syntax before the definition.
Astoundingly so. I still prefer list-before-colon, but the above would
alleviate much of my distate for @ which is that it doesn't look as
though the decorators are connected to the definition.

Hmm - perhaps a further variation ...

    |paramnames(username='Username', password='Password')
    |
    |webmethod(username=str, password=str)
    |
    def login(self, username, password, return_to=None):
        request = current.request

i.e. the decorators must be connected to the def, but you can use some
whitespace to make them look better (for decorators with long parameter
lists). Would be hell to parse though ...

Tim Delaney
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