http://effbot.org/pyfaq/where-do-i-start-if-i-want-to-learn-about-the-cpython-implementation.htm
Q. Anyone have any good advice to someone interested in learning about innards of the Python implementation?
A. There are only a handful of top level directories that are interesting:
- Include - include files
- Objects - all Python objects (list, dict, int, float, functions, and many others)
- Python - core interpreter and other support facilities
- Lib - Python stdlib (Lib/test is the test suite)
- Modules - C extension modules
- Parser - simple parser/tokenizer
The last three probably aren’t interesting. However, if you are interested in the GC (or SRE) implementation, then you should look under Modules as gcmodule.c and _sre.c are there. So are a bunch of others.
Include isn’t particularly interesting. Objects isn’t too interesting either from the standpoint of learning about the interpreter. Although the object implementations may be interesting in their own right. Each object is in an unsurprising file named something like: listobject.c or intobject.c.
That leaves Python which is where the real innards are. If you are interested in the interpreter, thenPython/ceval.c is pretty much it. The compiler is primarly in Python/compile.c, but also see Python/ast.c(2.5 only) and Python/symtable.c. All the global builtin functions are in Python/bltinmodule.c. Import support is in Python/import.c. Most of the other files in Python are small and/or platform specific. They probably aren’t as interesting in general.
(Based on a comp.lang.python post by Neal Norwitz)
CATEGORY: general
CATEGORY: cpython