inline comparison
Steve Holden
steve at holdenweb.com
Mon Mar 21 21:49:14 EST 2005
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/
More information about the Python-list
mailing list