[Python-Dev] Class decorators

Guido van Rossum guido at python.org
Wed Mar 29 21:07:12 CEST 2006


On 3/28/06, Phillip J. Eby <pje at telecommunity.com> wrote:
> If we're using Zope 3 as an example, I personally find that:
>
>      class Foo:
>          """Docstring here, blah blah blah
>          """
>          implements(IFoo)
>
> is easier to read than:
>
>      @implements(IFoo)
>      class Foo:
>          """Docstring here, blah blah blah
>          """

But the former also smells more of magic. A function putting a magic
variable into the scope in which it is called isn't exactly elegant
use of Python. You've probably read too much Zope code to be sensitive
to this argument; but to me it still grates.

--
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list