dir(re.compile(pattern))
does not return pattern as one of the lists's elements. Namely it returns:
['__copy__', '__deepcopy__', 'findall', 'finditer', 'match', 'scanner', 'search', 'split', 'sub', 'subn']
According to the manual, it is supposed to contain
the object's attributes' names, the names of its class's attributes, and recursively of the attributes of its class's base classes.
It says also that
The list is not necessarily complete.
Is there a way to get the complete list? I always assumed that dir returns a complete list but apparently it does not...
Also: is there a way to list only attributes? Or only methods?
Edit: this is actually a bug in python -> supposedly it is fixed in the 3.0 branch (and perhaps also in 2.6)
dir()
or the inspect module is generally the right way to do it. Did you usere
module just as an example or do you want to achieve a special goal? – Inness__dir__()
– Paradise