15
I tried googling but gotten no authoritative answer.
Can someone confirm that the re module http://docs.python.org/2/library/re.html
is thread-safe?
More specifically, which functions are and which are not?
Also, can I reuse a single global compiled re object to do sub, search, etc. safely across threads?
Seems like there is still no clear answer?
Ok, a more specific example:
class MyClass:
GLOBAL_VAR = re.compile(...)
def clean(self, value):
return MyClass.GLOBAL_VAR.sub('', value)
Will this work as expected when multiple threads call clean at the same time?