Message194352
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. |
|
Date |
User |
Action |
Args |
2013-08-04 11:49:38 | loewis | set | recipients:
+ loewis, rhettinger, ncoghlan, lukasz.langa, hynek, serhiy.storchaka |
2013-08-04 11:49:38 | loewis | set | messageid: <1375616978.47.0.912634231601.issue18652@psf.upfronthosting.co.za> |
2013-08-04 11:49:38 | loewis | link | issue18652 messages |
2013-08-04 11:49:38 | loewis | create | |
|