What is CPython written in?
CPython, the reference implementation of Python, is written primarily in C. Its interpreter, object model, and most of the standard library are implemented in C. Some higher-level standard library modules (like email or html.parser) are written in Python.
Details
CPython is the canonical Python implementation. When Python documentation refers to "Python," it typically means CPython's behavior.
CPython's core — the bytecode interpreter, memory allocator, garbage collector, object model, and C API — is implemented in C. This gives CPython excellent interoperability with C libraries via the Python/C API.
CPython compiles Python source files to .pyc bytecode files, which the interpreter then executes. This is distinct from true ahead-of-time compilation.
Explore in the Graph
See implementation and influence relationships interactively.
Open Interactive Graph →