inline comparison

sam sam.wun at
Tue Mar 22 03:40:14 CET 2005

Diez B. Roggisch wrote:

> If you really need that sort of dependent matching, there are better ways to
> accomplish that in python:
> for m, name in [self.macro_parser, self.a_parser, self.b_parser, ...]:
>     mo = m.match(data)
>     if mo:
>        break
Hi, this method looks more elegant.
However I got the following error:
     for m, name in [self.macro_parser]
SyntaxError: invalid syntax

What is the valid syntax with this usage?



More information about the Python-list mailing list