"Dick Moores" <[EMAIL PROTECTED]> 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:

http://svn.python.org/view/python/trunk/Python/bltinmodule.c?rev=52315&view=markup

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)
{
        return PyNumber_Absolute(v);
}

HTH,

Alan G. 


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to