two ideoms at one blow: line-reading and regexp-matching

Jason Orendorff jason at jorendorff.com
Mon Feb 25 00:30:38 EST 2002


Paul Rubin wrote:
> I don't see your idiomatic 6-line while loop as being neater or
> more orderly as the straightforward 2-line version that uses :=
> in the control expression.

Your version was:

   while (m := re.match(pat,x)):  blah()

Isn't that an endless loop?

## Jason Orendorff    http://www.jorendorff.com/




More information about the Python-list mailing list