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

[Python-Dev] A decorator syntax not yet mentioned (I think!)

[Python-Dev] A decorator syntax not yet mentioned (I think!) [Python-Dev] A decorator syntax not yet mentioned (I think!)Simon Percivall s.percivall at chello.se
Wed Aug 11 17:30:04 CEST 2004
On 2004-08-11, at 17.16, John Marshall wrote:
> How about the following, which I am almost positive
> has not been suggested:
> -----
> class Klass:
>     def __init__(self, name):
>         self.name = name
>
>     deco meth0:
>         staticmethod
>     def meth0(x):
>         return x
>
>     deco meth1:
>         classmethod
>     def meth1(cls):
>         return cls
>
>     deco sayhello:
>         funcattrs(name='GvR', language='python')
>         log(file='func.log')
>     def sayhello(self):
>         print 'hello python world'
>
> Any comments?

There is the problem that you have to repeat the name of the function
you define. Repetition of this kind leads to error. It also takes more
place and distracts more from the actual function than most of the
other syntax. Also, there is the "new keyword" problem, leading to
breakage if older code uses the "deco" name.

//Simon

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