Glossary

CPython

CPython is the reference (and by far the most widely used) implementation of the Python programming language. It is written in C and maintained by the core development team under the governance of the Python Software Foundation. When people say "Python" without further qualification, they almost always mean CPython.

CPython works in two stages. First, it compiles Python source code into an intermediate form called bytecode — a lower-level, platform-independent set of instructions stored in .pyc files inside the __pycache__ directory. Second, the CPython virtual machine (sometimes called the Python VM or the bytecode interpreter) executes those instructions one by one. This two-stage process is why Python is often described as both compiled and interpreted.

A defining characteristic of CPython is the Global Interpreter Lock (GIL), a mutex that allows only one thread to execute Python bytecode at a time. The GIL simplifies memory management and C extension integration but limits true multi-threaded parallelism for CPU-bound work. Experimental free-threaded builds (PEP 703) are being developed to remove this limitation. Alternative implementations like PyPy, Jython, and GraalPy take different approaches to bytecode execution and the GIL.

Related terms: Python, Bytecode, GIL, Interpreter

Discussed in:

This site is currently in Beta. Please email Chris Paton (cpaton@gmail.com) with any suggestions, questions or comments.