Possible Duplicate:
Type of compiled regex object in python
Usually I would do isinstance(obj, ThePatternType)
but I cannot see how to get ThePatternType
.
When I create an instance of a compiled regex pattern, the type gives:
type(pattern)
<type '_sre.SRE_Pattern'>
But for some reason I cannot do from _sre import SRE_Pattern
I realise I could do, ThePatternType = type(re.compile(r'.'))
, but that just seems wrong!