sam wrote:
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?

Thanks
Sam


You've missed the colon off after the "for" statement. I do it all the time ...

regards
 Steve
--
Meet the Python developers and your c.l.py favorites March 23-25
Come to PyCon DC 2005                      http://www.pycon.org/
Steve Holden                           http://www.holdenweb.com/
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to