[Python-Dev] Re: Decorators: vertical bar syntax

David Eppstein eppstein at ics.uci.edu
Mon Aug 9 20:45:06 CEST 2004


In article <1092074454.8687.26.camel at localhost>,
 Barry Warsaw <barry at python.org> wrote:

> > I prefer @ but am willing to accept | as a compromise.
> 
> I agree with Paul here.  The only reason I suggested | was to make life
> easier for 3rd party tools.

But does it?

With @, a third party tool has an unambiguous indication of whether a 
line is a decorator.  With |, it is not possible to recognize decorators 
with a regular expression, instead you have to do some context-free 
parsing to determine whether some previous line has an unclosed paren 
(in which case the | is a binop rather than a decorator).

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



More information about the Python-Dev mailing list