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

Jess Austin jess.austin at gmail.com
Tue Aug 24 16:53:58 EDT 2004


Arien Malec <arien_malec at yahoo.com.REMOVE> wrote in message news:<Xns954E696D4D95Darienmalecyahoocom at 64.164.98.29>...
> "Paul McGuire" <ptmcg at austin.rr._bogus_.com> wrote in
> news:pUTVc.8393$Jn5.5720 at fe1.texas.rr.com: 
> > Please start giving some thought to what the 'decorate' keyword should
> > be. If we can get/keep this selection to a manageable list, then we
> > should have another multivote some time next week.
> 
> "transform:"
> 
> In general:
> 
> Something that is either semantic neutral, or makes semantics explicit.

A verb of neutral meaning, like "transform", seems more likely to
cause difficulty with old code.  I would expect there to be hundreds
of Python functions in use right now with the name "transform",
because that verb encompasses many things that functions often do.  A
function may be called at any level of indentation, and there would be
no way for the parser to distinguish a function call from a
decoration.  This same objection can be voiced about any keyword, and
is the reason why this option would definitely entail an "from
__future__ import decorators", but many words would conflict less than
"transform".

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.

later,
Jess



More information about the Python-list mailing list