Martin v. Löwis added the comment:
Nick: that the code is difficult to decipher is really the fault of functional
programming, which is inherently difficult to decipher (since last function
applied is written first).
Explicit iteration is easier to read. I would write Hynek's example as
for r in (re1, re2):
m = r.match('abc')
if not m:
print('No match)
elif r is re1:
print('re1', m.group(1))
elif r is re2:
print('re1', m.group(1))
break # always
This is only two additional lines, very Pythonic (IMO), and doesn't invoke
match unnecessarily.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue18652>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com