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

Phillip J. Eby pje at telecommunity.com
Wed Mar 31 19:23:24 EST 2004


At 03:18 PM 3/31/04 -0800, Michel Pelletier wrote:
>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?

It's not equally usable.  It is 1) considerably more verbose, particularly 
in Bob's use case of long function names, and 2) hard to spot by a reader 
who's skimming to get an overview of a class or module.


>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.

I have seen virtually no use of decorators on interface methods in the 
frameworks you mention.  In fact, I can't recall ever having seen a single 
use of decorators on interface methods.  That's probably simply because the 
cost of using decorators is too high to waste on anything that's not part 
of the implementation, and the documentary value of decorators using 
today's syntax is poor compared to adding text to the method's docstring.




More information about the Python-Dev mailing list