Author loewis
Recipients hynek, loewis, lukasz.langa, ncoghlan, rhettinger, serhiy.storchaka
Date 2013-08-04.11:49:38
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1375616978.47.0.912634231601.issue18652@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2013-08-04 11:49:38loewissetrecipients: + loewis, rhettinger, ncoghlan, lukasz.langa, hynek, serhiy.storchaka
2013-08-04 11:49:38loewissetmessageid: <1375616978.47.0.912634231601.issue18652@psf.upfronthosting.co.za>
2013-08-04 11:49:38loewislinkissue18652 messages
2013-08-04 11:49:38loewiscreate