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

[Python-Dev] decorator support

[Python-Dev] decorator supportXavier Combelle xavier.combelle at free.fr
Sat Sep 18 02:57:36 CEST 2004
>
> This could be used to define a decorator
>
> @copyfuncattrs
> def trace(f):
>     def do_trace(*args):
>         print "invoking", f.__name__, args
>         return f(*args)
>     return do_trace

I am quite new in Python, and I do my first suggestions. (One time
I should begin)

If there is a general agreement about what to do to wrap a decorator,
why no use the following syntax

@decorator
def trace(f):
    def do_trace(*args):
        print "invoking", f.__name__, args
        return f(*args)
    return do_trace

I would prefer it because it explain what the method do
instead of how it implement it.
Generally speaking, I believe the decarators should
be very expressive, just because even if it is not
a part of  the language, it's a kind of new syntax.
For the same reason, Python should incorporate
just a reduce set of decorators.

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