[Tutor] Where is the __builtin__ module?
alan.gauld at btinternet.com
Mon Feb 19 17:39:13 CET 2007
"Dick Moores" <rdm at rcblue.com> wrote
> "import __builtin__" occurs frequently in files in Lib/,
Really? I'm surprised, I can't think why.
> unable to find a module named "__builtin__" or "__builtin__.py"
> anywhere in my Python 2.5. Is there one? If there is, where is it?
It's C code so it's not a .py file.
There is probably a C library/DLL somewhere but the whole
point of builtin is that it is built in to the core Python interpreter
so there is no physically separate file you can see.
You can read the C source here:
However you'll find that most of them basically just forward the
call to another function elsewhere - sometimes with a bit of
input validation first. See the abs() function as a short example:
static PyObject *
builtin_abs(PyObject *self, PyObject *v)
More information about the Tutor