I want to tell whether an object is a regular expression pattern.
Python 3.2.3 (default, Oct 19 2012, 20:10:41) [GCC 4.6.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import re >>> s = "hello" >>> type(s) <class 'str'> >>> isinstance(s, str) True >>> my_pattern = re.compile(s) >>> type(my_pattern) <class '_sre.SRE_Pattern'> >>> isinstance(my_pattern, _sre.SRE_Pattern) Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name '_sre' is not defined -- http://mail.python.org/mailman/listinfo/python-list