What is the type of the compiled regular expression in python?
In particular, I want to evaluate
isinstance(re.compile(\'\'), ???)
Prevention is better than cure. Don't create such a heterogeneous list in the first place. Have a set of allowed strings and a list of compiled regex objects. This should make your checking code look better and run faster:
if input in allowed_strings:
ignored = False
else:
for allowed in allowed_regexed_objects:
if allowed.match(input):
ignored = False
break
If you can't avoid the creation of such a list, see if you have the opportunity to examine it once and build the two replacement objects.