[Python-Dev] Re: Plea for simpler decorator syntax, in addition to pie-shaped syntax

David Eppstein eppstein at ics.uci.edu
Thu Aug 5 20:39:10 CEST 2004


In article <20040805174619.GB27820 at burma.localdomain>,
 Gustavo Niemeyer <niemeyer at conectiva.com> wrote:

> > IMO, the most common uses of decorators will be to define properties,
> > and class and static methods.  IMO, these uses would be better served
> > by a simpler syntax:
> > 
> >   def classmethod foo(cls, ...):
> >       ...
> > 
> > This simplified syntax only allows names to specify decorators.  It
> > could allow multiple names, although I'm not sure it should,
> > 
> > I find this *far* more readable and obvious than any of the other syntaxs
> > I've seen propsed.
> 
> Agreed.

Disagreed.  It works fine when the decorator is as short as 
"classmethod" and the function signature is as short as "foo(cls, ...)".
It breaks down when those are long enough that the whole thing doesn't 
fit on a single line, which I'm expecting will happen a reasonably large 
fraction of the time.

I like pie.

-- 
David Eppstein
Computer Science Dept., Univ. of California, Irvine
http://www.ics.uci.edu/~eppstein/



More information about the Python-Dev mailing list