remaining decorator syntax options

Steven Bethard steven.bethard at
Wed Aug 11 17:17:57 CEST 2004

Shalabh Chaturvedi <shalabh at> wrote in message news:<mailman.1472.1092171803.5135.python-list at>...
> @staticmethod
> @foo.moredecoration(a="hello",b="world")
> def myfunc():
> vs.
> using [staticmethod ,foo.moredecoration(a="hello",b="world"),]
> def myfunc():
> (I find the first version clearer.)

Yup.  Though I think most people would write the second option
something like:

using [staticmethod,
def myfunc():

(with, of course, a hundred different tabulation options there, but
you get the idea).  My point was that with the keyword, you save a lot
of keystrokes using the list if you have a large number of decorators,
but with a single symbol, of course, using a list only adds
keystrokes.  You make some good points though, and I would be just as
happy with:

using staticmethod
using foo.moredecoration(a="hello",b="world")
def myfunc():

> Btw, I think your summary of the current state is good. However I feel a 
> new keyword has been pretty much ruled out as well.

Can you refer me to some pages that made you feel this way?  GvR said
that he "won't rule it out just because of the new keyword":

I also haven't seen any arguments against keywords that said anything
but basically "introducing a new keyword might break existing code". 
Not that this isn't a valid argument, but as Python has gone through a
similar process recently for 'yield', I'd feel more like keywords were
ruled out if I heard some other arguments.


More information about the Python-list mailing list