Message170767
| 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. |
|