[Twisted-Python] Using decorator syntax in Twisted
exarkun at twistedmatrix.com
exarkun at twistedmatrix.com
Thu Dec 1 10:53:36 EST 2011
On 03:24 pm, itamar at itamarst.org wrote:
>Until now we haven't AFAIK used decorator syntax, but I think it's time
>we start to. In places where we were already using decorators without
>the special syntax, that is.
>
>Consider:
>
> def foo(cls, arg):
> # lalalal
> foo = classmethod(foo)
>
>One has to type "foo" three times (a potential source of error), and
>the special semantics of the function are known to the reader only
>*after* reading the function. On the other hand:
>
> @classmethod
> def foo(cls, arg):
> # lalalal
>
>This suffers from none of these problems.
>
>Any disagreement?
Can we start with a limited experimental usage? Some new code can be
written this way, and we'll see if there's any negative feedback
following the next release.
I don't want existing code to get ported to the new syntax just because
it's possible now.
Jean-Paul
More information about the Twisted-Python
mailing list