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

David Eppstein eppstein at ics.uci.edu
Mon Aug 9 22:49:20 CEST 2004


In article <cf8l1e$9rk$1 at sea.gmane.org>,
 "Fredrik Lundh" <fredrik at pythonware.com> wrote:

> David Eppstein wrote:
> 
> > 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).
> 
> "\
> @decorator #"
> 
> """
> @decorator
> """
> 
> (etc)
> 
> </F>

I think quoted string recognition in Python is still regular, not 
context-free.  Anyway, the syntax highlighters in editors that I've used 
don't seem to have a problem with it.

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



More information about the Python-Dev mailing list