For review: PEP 308 - If-then-else expression
Andrew Koenig
ark at research.att.com
Sun Feb 9 09:56:01 EST 2003
Paul> I'd say every time I write code with regexps, I want an assignment
Paul> expression like
Paul> while (m := re.match(exp, something)): ...
Paul> so if I could add just one construct, assignment expressions or
Paul> conditional expressions, I'd probably take assignment
Paul> expressions even though they don't do as much from a functional
Paul> programming point of view.
Meanwhile, you can do this:
def update(x, y):
x[0] = y
return y
m = [None]
while (update(m, re.match(exp, something))): ...
--
Andrew Koenig, ark at research.att.com, http://www.research.att.com/info/ark
More information about the Python-list
mailing list