[Twisted-Python] Using decorator syntax in Twisted

Itamar Turner-Trauring itamar at itamarst.org
Thu Dec 1 08:24:32 MST 2011


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?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20111201/ba57c1f8/attachment-0001.html>


More information about the Twisted-Python mailing list