[Python-Dev] Class decorators

Guido van Rossum guido at python.org
Tue Mar 28 21:04:54 CEST 2006


On 3/28/06, Phillip J. Eby <pje at telecommunity.com> wrote:
> At 10:01 AM 3/28/2006 -0800, Guido van Rossum wrote:
> >OK, I'm convinced (mostly by the awful hackery that Phillip so proudly
> >exposed :-).
>
> Just as a historical note, here's where you previously rejected the same
> hackery as an argument for supporting class decorators:
>
> http://mail.python.org/pipermail/python-dev/2004-March/043462.html
>
> Ironically, the subsequent discussion following the above message brought
> me around to your point of view.  :)
>
> Or more precisely, the subsequent discussion and examples convinced me that
> putting class decorators on top of the class was bad for readability, vs.
> putting them in the body just after the docstring.  As you said, "the use
> cases are certainly very *different* than those for function/method
> decorators".
>
> So at this point I'd rather see a way to make my hackery go away (or become
> part of the standard library in some fashion) rather than simply mimic
> @decorators for classes.

That's fine. But there's also the C#/Java POV. I'm somehow concerned
that any mechanism that puts the syntax inside the class body is
somehow going to have a hackish implementation, but I'd be glad to be
proven wrong, so please come up with a concrete proposal!

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


More information about the Python-Dev mailing list