What is Python written in?

Python's reference implementation, CPython, is written primarily in C. The language specification itself is implementation-independent, but CPython is the dominant runtime and is implemented in C for performance and portability. Other implementations include Jython (Java), PyPy (Python/RPython), and IronPython (.NET).

Quick Facts

Short answer
CPython is written primarily in C
Language spec
Implementation-independent
Main runtime
CPython
Other implementations
PyPy, Jython, IronPython

Details

When people ask "what is Python written in?" they usually mean the CPython implementation language. CPython is the reference implementation maintained by the Python Software Foundation. Its interpreter core, object model, memory allocator, and C API are implemented primarily in C, with many higher-level library modules written in Python.

Because its core is written in C, Python is often said to be "built on C". However, Python as a language specification is separate from any particular implementation. The specification does not require C. CPython is simply the dominant runtime and the behavior most people mean when they say "Python."

Python implementation layers

LayerWritten inRole
CPython coreCInterpreter, object model, memory management, C API
Standard libraryPython and CBuilt-in modules, libraries, extension modules
Alternative runtimesRPython, Java, C#PyPy, Jython, IronPython

The dataset records a runtime_written_in relationship from C to Python because CPython is the reference and most widely deployed Python runtime.

Explore in the Graph

See implementation and influence relationships interactively.

Open Interactive Graph →

Related Pages