I am studying the python regular expression (re.py
) source code.
In re.py
they imported the module sre_compile
:
import sre_compile
and I look at the module sre_compile there they imported the module _sre
in the line 13
import _sre, sys
I searched for the module _sre.py
but I could not find it anywhere, I even tried to
locate _sre.py
in my shell.
In the end I tried to locate it with the python interpreter. I imported _sre
and I was trying to look for the __file__
attribute of _sre
but it gave me the following error:
AttributeError: 'module' object has no attribute '__file__'
Where can I find the _sre
module source code?
_sre
exists within the Python source code. (And there's a specific reason they need help finding it.)_sre
(be it_sre.c
or otherwise), so the existing answer seems incomplete. Vote to reopen.