>>>>> "AK" == Andrew Koenig <ark@research.att.com> writes: Jeremy> I'd put this at the module level: compiled_re_type = Jeremy> type(re.compile("")) Jeremy> Then you can use isistance() to test: Jeremy> isinstance(re.compile("spam+"), compiled_re_type) AK> But is it guaranteed that re.compile will always yield an object AK> of the same type? Hard to say. I can read the code and see that the current implementation will always return objects of the same type. In fact, it's using type(sre_compile.compile("", 0)) internally to represent that type. That's not a guarantee. Perhaps Fredrik wants to reserve the right to change this in the future. It's not unusual for Python modules to be under-specified in this way. Jeremy
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4