Paul McGuire <[EMAIL PROTECTED]> writes: [...]
> lambda is handy in defining parse actions in pyparsing. Parse actions > are callbacks to be run when an expression within a larger grammar is > matched. A common use for parse actions is to do some sort of text or > type conversion. The simplest parse actions are called using the list > of matched tokens. Here is a subexpression that will convert numeric > strings found in a larger grammar to ints: > > integer = Word("0123456789").setParseAction(lambda tokens: > int(tokens[0]) ) Could you use it as a decoratore instead? integer = Word("0123456789") @integer.setParseAction def parse_integer(tokens): return int(tokens[0]) I could make your grammar clearer, because you don't mix it with processing code... and no need for lambdas! -- Arnaud -- http://mail.python.org/mailman/listinfo/python-list