[Python-Dev] Re: Python-Dev Digest, Vol 8, Issue 107

Michel Pelletier michel at dialnetwork.com
Wed Mar 31 18:18:35 EST 2004


On Wed, 2004-03-31 at 12:52, python-dev-request at python.org wrote:
> Message: 6
> Date: Wed, 31 Mar 2004 12:49:14 -0800
> From: Guido van Rossum <guido at python.org>
> Subject: Re: [Python-Dev] PEP 318: Decorators last before colon
> To: "Phillip J. Eby" <pje at telecommunity.com>
> Cc: python-dev at python.org
> Message-ID: <200403312049.i2VKnEi14444 at guido.python.org>
> 
> > There appears to be a strong correlation between people who have
> > specific use cases for decorators, and the people who want the
> > last-before-colon syntax.  Whereas, people who have few use cases
> > (or don't like decorators at all) appear to favor syntaxes that move
> > decorators earlier.  Whether that means the "earlier" syntaxes are
> > better or worse, I don't know.  <0.5 wink>
> 
> Maybe the practitioners are so eager to have something usable that
> they aren't swayed as much by esthetics.

The current system with no syntax is equally usable, what's gained
functionally?  This argument was and is often used against interface
syntax; it's a strong argument.  In the case of interfaces the argument
was against one nine letter keyword that could not possibly be confused
with a list or anything else.  This syntax is riskier.  

> The human brain is a lot more flexible in picking up patterns than the
> Python parser; as shown many times in this discussion, most people
> have no clue about the actual syntax accepted by the Python parser,
> and simply copy (and generalize!) patterns they see in examples.

Or like me, they just do what Emacs tells 'em, which does argue for
decorators of any or no syntax.  Javadoc coming before a method is
another precedent in favor of something coming before, but these are
without run-time function.

> > It also seems to be working against the AST branch a bit, in that I
> > would expect the decorator expressions to be part of the function
> > definition node, rather than in an unrelated statement.

Another discussion point occurred to me regarding interfaces and
projects that use them heavily like Zope, Twisted, PEAK etc.  Has the
decorator syntax as proposed been evaluated in the light of these
interfaces (and any future native language support for them), whose
methods have no body to interpose between the definition and decorators
as they exist now?  I've seen the "Large Body" argument use several
times in defense of the decorator syntax being before or above the
definition.

-Michel




More information about the Python-Dev mailing list