>>>>> "AK" == Andrew Koenig <ark@research.att.com> writes: AK> How do I test for the third? I guess I need to know the name of AK> the type of a compiled regular expression object. Hmmm... A AK> quick scan through the documentation doesn't reveal it. So I do AK> an experiment: >>>> import re re.compile("foo") AK> <_sre.SRE_Pattern object at 0x111018> AK> Hmmm... This doesn't look good -- Can I really count on a AK> compiled regular expression being an instance of AK> _sre.SRE_Pattern for the future? I'd put this at the module level: compiled_re_type = type(re.compile("")) Then you can use isistance() to test: isinstance(re.compile("spam+"), compiled_re_type) 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