[Python-Dev] Re: Another approach to decorators.

David Abrahams dave at boost-consulting.com
Thu Aug 12 20:10:37 CEST 2004


Guido van Rossum <guido at python.org> writes:

> [Various proposals suggesting the use of a single decorator block to
> decorate multiple method definitions]
>
> I'm not keen on this.  I expect that beyond classmethod and
> staticmethod there aren't many use cases for repeating the same
> decorator exactly multiple times.  It also requires indenting the
> method, which I've already argued against.  And lastly it removes the
> decorator from the method definition again, thereby defeating the
> readability goals: when you look at a def in isolation, you may forget
> to look several pages up for a decorator.
>
> I think this is too far-fetched to consider as an alternative to the
> humble @decorator.


Maybe, but if you're still serious about improving support for
domain-specific embedded languages in Python you ought to give the
ideas another look.  If a reasonable syntax for decorators falls out
of a more general and useful mechanism, so much the better.

-- 
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com



More information about the Python-Dev mailing list