I need to check if a variable is a regular expression match object.
print(type(m)) returns something like that: <_sre.SRE_Match object at 0x000
print(type(m))
<_sre.SRE_Match object at 0x000
Pile-on, since there's a whole bunch of ways to solve the problem:
def is_match_obj(m): t = type(m) return (t.__module__, t.__name__) == ('_sre', 'SRE_Match')