[Python-Dev] Decorator syntax J2 (decorate..def), with implementation

Paul Du Bois paul.dubois at gmail.com
Sat Aug 14 01:35:32 CEST 2004


[bob, apologies for the re-send... I'm a gmail newbie]

On Fri, 13 Aug 2004 19:24:24 -0400, Bob Ippolito <bob at redivi.com> wrote:
> My only problem with this syntax is that I expect the common cases
> (mine, anyway) to be zero or one decorators per function, so the extra
> block and indent seems a bit excessive compared to the current
> @prefix-symbol-decorator proposal(s).  It is, of course, far better

For the case of one decorator, one could allow:

decorate: staticmethod
def p_statement_expr(self, p):
   pass

Which is admittedly more typing than @staticmethod -- but is brevity a feature?

Even if "decorate" is an inaccurate description of what the decorator
is doing (it may registering, creating grayscale ramps, and so on) it
at least matches the name of the language feature: decorators. Good
for documentation!

This is my favorite proposal so far.


More information about the Python-Dev mailing list