[Python-Dev] 2.4a2, and @decorators

Guido van Rossum guido at python.org
Tue Aug 3 05:51:38 CEST 2004


> Well, I'm not. It seems like a decision made in haste.

Hardly.

> Maybe I'll get used to it in a few decades, but right
> now I feel very disappointed. We were *so* close to
> agreeing on something nice, and then for some reason
> it all went pear-shaped. :-(

Not really.  The contenders were:

- [decorators] after the arguments.  I really hate this, for good
  reasons which I won't repeat here.

- [decorators] in front of the 'def'.  For a while I really loved
  this, but several killer arguments were made against it, most having
  to do with the ambiguity, which confuses beginners.  (A couple of
  people in the audience of my EuroPython keynote stood up and argued
  this with passion.)

- Any number of variations on [decorators] before 'def', adding
  arbitrary mark-up to make it unambiguous.  Including the 'as'
  keyword (which it isn't, by the way).  All of which strike me as
  totally arbitrary.  The 'as' keyword has a history of uses for
  renaming (e.g. in SQL and Python's import) but decorators are
  everything but renaming.

- @decorators in front of 'def'.  This is borrowed from Java (just
  like [decorators] was borrowed from C#) so minimizes invention.  It
  isn't ambiguous, and as long as we're going to use arbitrary syntax
  we might as well use something that's familiar to at least one huge
  group of potential Python users.

And yes, I'm not 100% comfortable with it either.  But I know one
thing: in this particular case, now is better than never.  So I'm
picking a solution everybody can hate equally.

(What's wrong with pear-shaped, anyway?  It's one of my favorite
shapes. :-)

--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list