Does a '_sre.SRE_Pattern' have state,or is it thread-safe?
Stephen Hansen
ixokai at ixokai.io
Wed Jun 23 13:27:50 EDT 2010
On Jun 23, 2010, at 9:10 AM, John Nagle <nagle at animats.com> wrote:
> '_sre.SRE_Pattern' is what "re.compile" returns.
>
> Is that a mutable object, with state that changes
> during the parse, or is it an immutable constant? Can
> two threads use the same '_sre.SRE_Pattern' at the same time?
Ouch. I hope it is thread safe or I have some problems. But: since
compiled regular expressions are automatically cached and used when
one throws non compiled expressions into re, ISTM they have to be
thread safe. Or we'd have tons of problems.
--Stephen via iPad.
More information about the Python-list
mailing list