function attributes (ANN: Introducing PLY-1.0 (Python Lex-Yacc))

Edward C. Jones edcjones at erols.com
Wed Jun 20 11:45:49 EDT 2001


David Beazley wrote:

> M.-A. Lemburg writes:

> I'd definitely consider using them if they were syntactically
> convenient to use. However, I'm mostly at a loss as to how you
> would actually go about doing that. I suppose you could
> have something like this:
> 
>    def p_expr_plus(t):
>        .gram = 'expr : expr PLUS expr'
>        ...


Perhaps "self" could be made a keyword. Then you could say:

     def p_expr_plus(t):
        self.gram = 'expr : expr PLUS expr'
         ...

Ed Jones





More information about the Python-list mailing list