How to do this in Python...
Peter Hansen
peter at engcorp.com
Mon Jan 27 10:31:32 EST 2003
Michael Tiller wrote:
>
> > for i in [1]:
> > m = re.match(...)
> > if m:
> > ...
> > break
> >
> > m = re.match(...)
> > if m:
> > ...
> > break
>
> I'm happy that works for you. I'm curious if others in the Python community
> find that an acceptable alternative?!?
I certainly don't. But, as I said, I've yet to find a case where my
own suggestion could not work. At first, sometimes, it looks like it
won't work, but then I realize that if I actually think I need to include
the code right there in the if statements, my design is already broken,
and I fix it to allow the much better approach with the tuple-list...
But you didn't want to hear that again, did you? ;-)
-Peter
More information about the Python-list
mailing list