Author ezio.melotti
Recipients barry, ezio.melotti, loewis, nadeem.vawda, orsenthil, r.david.murray, rosslagerwall, serhiy.storchaka
Date 2012-09-19.20:25:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1348086335.45.0.638704605617.issue11454@psf.upfronthosting.co.za>
In-reply-to
Content
That might work.

To avoid the overhead of the cache lookup I was thinking about something like

regex = None
def _has_surrogates(s):
    global regex
    if regex is None:
        regex = re.compile(short_regex)
    return regex.search(s)

but I have discarded it because it's not very pretty and still has the overhead of the function and an additional if.  Your version solves both the problems in a more elegant way.
History
Date User Action Args
2012-09-19 20:25:35ezio.melottisetrecipients: + ezio.melotti, loewis, barry, orsenthil, nadeem.vawda, r.david.murray, rosslagerwall, serhiy.storchaka
2012-09-19 20:25:35ezio.melottisetmessageid: <1348086335.45.0.638704605617.issue11454@psf.upfronthosting.co.za>
2012-09-19 20:25:34ezio.melottilinkissue11454 messages
2012-09-19 20:25:34ezio.melotticreate