R. David Murray added the comment: This issue may be about reducing the startup time, but this function is a hot spot in the email package so I would prefer to sacrifice startup time optimization for an increase in speed.
However, given the improvements to import locking in 3.3, what about a self replacing function? def _has_surrogates(s): import email.utils f = re.compile('[\udc80-\udcff]').search email.utils._has_surrogates = f return f(s) ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue11454> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com