Where is the __builtin__ module in CPython?

Latest (trunk) C sources of builtin module: svn.python.org/view/python/trunk/Python/....

Latest (trunk) C sources of __builtin__ module: svn.python.org/view/python/trunk/Python/....

That is great. Do you know which part of the module loading process handling builtin module specially? – Thomson Feb 13 at 2:17 @Thomson, I can't tell for granted, but perhaps no special code involved.

Just a data structure (vulgar C struct) which defines the module and contains pointers to the functions we can see in the bltinmodule.c. Just as any other native module in C API. Then they probably just link the bltinmodule.

O statically into libpython.so. Again — I don't know this for sure, just guesses. In any case, I'd did exactly like that.

– ulidtko Feb 13 at 2:21 @Thomson, so, it turns out that I was right. The module definitions go near the end of the file; regarding your question about loading of __builtin__ module — this is simple too: the module gets loaded together with the interpreter; this is the way how static linking works. May I ask, what you are trying to do?

– ulidtko Feb 13 at 2:50.

The __builtin__ module is built-in, there is no Python source for it. It's coded in C and included as part of the Python interpreter executable.

– Thomson Feb 13 at 2:11 1 @Thomson, see my answer. – ulidtko Feb 13 at 2:14 1 @Thomson I think it is in Python's source code.Python.Org/download/source – Artur Gaspar Feb 13 at 2:14.

You can't. It is built-in to the interpreter. >>> # os is from '/usr/lib/python2.7/os.

Pyc' >>> import os >>> os >>> # PyQt4 is from '/usr/lib/python2.7/site-packages/PyQt4/__init__. Pyc' >>> import PyQt4 >>> PyQt4 >>> # __builtin__ is built-in >>> import __builtin__ >>> __builtin__ In a program, you could use the __file__ attribute, but built-in modules do not have it. >>> os.

__file__ '/usr/lib/python2.7/os. Pyc' >>> PyQt4. __file__ '/usr/lib/python2.7/site-packages/PyQt4/__init__.

Pyc' >>> __builtin__. __file__ Traceback (most recent call last): File "", line 1, in AttributeError: 'module' object has no attribute '__file.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions