Alternative decorator syntax - POLL RESULTS SO FAR - ARE WE DONE?

Eli Stevens (WG.c) listsub at wickedgrey.com
Wed Aug 25 15:48:34 EDT 2004


Jess Austin wrote:
> Another objection that has been raised about my current favorite,
> "decorate", is that at 8 characters it's too long.  9 characters will
> also be considered too long by a number of people.
> 
> The natural short version of "decorate" would be "dec" and there is
> sort of a natural parallelism with "def" there.  I hesitate to
> nominate it because it _feels_ like a word that at least ten people on
> c.l.py will detest.
> 
> Maybe "decor"?  It isn't any longer than "class", and I think we can
> predict it will be typed less than 1/10 as often.  But this reasoning
> could also excuse "decorate", so I'll stick with that.  I'm also open
> to any transitive verb that can be designated to mean _exactly_ what
> "decorate" means now.

J2 J2 F, but I'm a lurker and Python newbie, so...  ;)

I kind of like the keyword "alter", but I suspect that, like many other 
such words, it will conflict quite a bit with existing code.  One of the 
issues that some have raised was the disconnect between the "using" and 
"def" lines.  What about copying the pattern used by if/elif; something 
like (I like the first the best, I think it "reads well," while the 
second is the shortest and has a nice rhythm):


alterdef:
     classmethod
def foo():
     pass


decdef:
     classmethod
def foo():
     pass


decoratedef:
     classmethod
def foo():
     pass


Of course, this will mean that there would also be an "alterclass:" if 
classes need decorators (in this case, "decclass:" doesn't seem as nice, 
and reusing "alterdef:" is downright misleading).

Just a thought,
Eli




More information about the Python-list mailing list