Question regarding re module

Diez B. Roggisch deets at nospam.web.de
Thu Jun 5 10:02:23 CEST 2008


Tomohiro Kusumi schrieb:
> Hi,
> 
> I have a question regarding re module.
> # By the way I'm not in this list, so I'm sorry but please CC me.
> 
> I tried following code in Python shell using a regular expression.
> Why doesn't the result of dir(reg) have 'pattern', 'flags', and
> 'groupindex' although they exist as members of _sre.SRE_Pattern
> instance ?
> 
> It sort of irritates me, because whenever I write Python code
> using a module which I'm not used to using, I often try Python
> shell with TAB complete to find out the member of module/instance.
>
It could be that the result overloads the __getattr__-method to delegate
calls to some object. Thus it's not part of the outer instance.

Diez



More information about the Python-list mailing list