The Python 2.7 official documentation here:
http://docs.python.org/library/re.html#re.compile
doesn't specify the type object returned by the re.compiled function.
According to the documentation, re.compile returns a "regular expression
object".
A regular expression object seems to be an instance of the class
RegexObject. The documentation mentions this class here :
http://docs.python.org/library/re.html#regular-expression-objects
but i don't see any existing class with this name :
>>> import re
>>> re.RegexObject
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'RegexObject'
>>>
Actually, a regular expression object doesn't seem to be a class object :
>>> import re
>>> reo = re.compile('')
>>> reo.__class__
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: __class__
>>>
but has attributes :
>>> dir(reo)
['__copy__', '__deepcopy__', 'findall', 'finditer', 'match', 'scanner',
'search', 'split', 'sub', 'subn']
>>>
I have the same problem with the match object : the doc mentions a
re.MatchObject class but this class doesn't exist :
>>> re.MatchObject
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'MatchObject'
>>>
Any clarification is welcome.
--
http://mail.python.org/mailman/listinfo/python-list