What is Python written in?
What Python is used for
Python is the default language of data science, machine learning, and AI, and a mainstay for scripting, automation, and back-end web development. Libraries like NumPy, pandas, PyTorch, and TensorFlow made it the lingua franca of analytics and deep learning, while Django and Flask power web apps.
Notable software written in or built on Python includes Instagram's backend, Dropbox, much of YouTube's early code, and tooling at Google and Netflix.
About Python
Python is a general-purpose programming language. It is a dynamically typed and garbage-collected language that is executed directly by an interpreter. It supports imperative, object-oriented, and functional programming.
Python first appeared in 1991 and was designed by Guido van Rossum. Development is led by Python Software Foundation. Today Python is one of the most widely used programming languages in the world.
Python in the language family tree
Python drew on ideas from Smalltalk, ABC, Modula-3, CLU, and Icon and went on to influence Ruby, CoffeeScript, Groovy, D, Mojo, and Julia.
Sources: Wikipedia · Wikidata · Official site
Quick Facts
- Short answer
- CPython is written primarily in C
- Language spec
- Implementation-independent
- Main runtime
- CPython
- Other implementations
- PyPy, Jython, IronPython
Python language vs CPython
When people ask what Python is written in, they almost always mean CPython, the reference implementation maintained by the Python Software Foundation. CPython is a bytecode interpreter: it compiles Python source code to a compact intermediate format and then executes those instructions inside a tight C loop called ceval.c. The parser, abstract-syntax-tree builder, bytecode compiler, and the main evaluation loop are all implemented in C.
CPython also ships the Python standard library, which is a mix: the performance-sensitive parts (regular expressions, JSON, CSV parsing, cryptography) are C extension modules, while the majority of the library is written in Python itself. This split reflects a deliberate design choice: write in Python where clarity matters, drop to C where speed does.
The Python language itself is a specification, not a piece of code. That specification does not mandate C. A compatible Python implementation can be written in any language as long as it follows the same language semantics defined in the CPython documentation and the language reference.
CPython architecture and the C extension API
CPython's internal architecture connects Python objects to C memory through a single foundational struct: PyObject. Every Python value, whether an integer, a list, or a function, is a PyObject at the C level. The reference-count field inside that struct drives CPython's primary memory management strategy: when the count reaches zero, the object is freed. A cycle-detecting garbage collector runs periodically to handle circular references that reference counting alone cannot reclaim.
CPython exposes a stable C extension API so that third-party libraries can implement performance-sensitive logic in C while behaving like ordinary Python modules. NumPy, Pandas, SciPy, and most data-science libraries use this API. Extensions link directly against the Python interpreter, which is why NumPy wheels are specific to a Python version and platform.
The GIL (Global Interpreter Lock) is a mutex inside CPython that protects the interpreter's internal state. Only one thread can execute Python bytecode at a time. This simplifies reference counting but limits parallelism on CPU-bound workloads. Python 3.13 introduced an experimental free-threaded build (PEP 703) that removes the GIL, though the ABI-stable extension ecosystem is still catching up.
Python implementations compared
| Implementation | Written in | Role |
|---|---|---|
| CPython | C and Python | Reference implementation and most common runtime |
| PyPy | RPython and Python | Alternative runtime with JIT compilation, often 5-10x faster on CPU-bound loops |
| Jython | Java | Python implementation that runs on the JVM and integrates with Java libraries |
| IronPython | C# | Python implementation for .NET; integrates with the CLR |
| MicroPython | C | Lean CPython-compatible implementation for microcontrollers |
| GraalPy | Java | Python on GraalVM, targeting high-throughput JIT performance |
Python release history
Guido van Rossum began Python in the late 1980s as a hobby project at Centrum Wiskunde and Informatica (CWI) in the Netherlands, aiming for a language that was easy to read and to teach. The first public release, Python 0.9.0, appeared in February 1991. Python 1.0 arrived in January 1994, adding lambda, map, filter, and reduce.
Python 2.0 (October 2000) introduced list comprehensions, garbage collection for cycles, and Unicode support. The 2.x line continued until Python 2.7 (2010), which received extended support through 2020 to ease migration.
Python 3.0 (December 2008) was a clean break: it unified the string and bytes model around Unicode, removed the old-style division behavior, and dropped several legacy warts. Adoption was initially slow because Python 3 was intentionally incompatible with Python 2. By the mid-2010s, the ecosystem had largely migrated.
The modern Python 3.x cycle follows an annual release cadence. Notable milestones: 3.5 (2015, async and await), 3.6 (2016, f-strings), 3.8 (2019, walrus operator), 3.10 (2021, structural pattern matching), 3.12 (2023, per-interpreter GIL, improved error messages), 3.13 (2024, free-threaded experimental build). Each minor release is supported for five years.
Frequently Asked Questions
Evidence Sources
- https://github.com/python/cpython
- https://en.wikipedia.org/wiki/Python_(programming_language)
- https://en.wikipedia.org/wiki/Ruby_(programming_language)
- https://en.wikipedia.org/wiki/CoffeeScript
- https://en.wikipedia.org/wiki/Apache_Groovy
- https://dlang.org/overview.html
- https://docs.modular.com/mojo/
- https://julialang.org/blog/2012/02/why-we-created-julia/
- https://nim-lang.org/documentation.html
- https://en.wikipedia.org/wiki/Elixir_(programming_language)
- https://en.wikipedia.org/wiki/Dart_(programming_language)
- https://en.wikipedia.org/wiki/Swift_(programming_language)
- https://en.wikipedia.org/wiki/Cython
- https://mypy-lang.org/
- https://en.wikipedia.org/wiki/Solidity
- Python on Wikidata (Q28865)