Skip to content
UPEEC

Runtime and Internals

How Python runs your code: memory, garbage collection, bytecode, the interpreter, the GIL and alternative implementations.

Advanced
Comments 0

This is an overview — pick a sub-topic below.

Sub-topics (10)

Memory Management

Every value is a heap object; names are references, and memory is reclaimed automatically.

Intermediate♥ 0🔖 0💬 0

Reference Counting

Each object counts how many references point to it and is freed when the count reaches zero.

Intermediate♥ 0🔖 0💬 0

Garbage Collection

The gc module finds and frees groups of objects that reference each other (cycles).

Intermediate♥ 0🔖 0💬 0

Python Bytecode

CPython compiles source to bytecode instructions that its virtual machine executes; dis shows them.

Advanced♥ 0🔖 0💬 0

The Python Interpreter

The program that runs Python code: python file.py, the interactive REPL, or python -m module.

Easy♥ 0🔖 0💬 0

The Global Interpreter Lock

In standard CPython only one thread executes Python bytecode at a time — threads help I/O, not CPU-bound work.

Advanced♥ 0🔖 0💬 0

CPython

The reference implementation of Python, written in C — what you get from python.org.

Intermediate♥ 0🔖 0💬 0

PyPy

A Python implementation with a just-in-time compiler — often several times faster for pure-Python code.

Intermediate♥ 0🔖 0💬 0

Jython

Python running on the Java Virtual Machine, able to use Java classes directly.

Intermediate♥ 0🔖 0💬 0

IronPython

Python for .NET, with direct access to .NET libraries.

Intermediate♥ 0🔖 0💬 0

Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.

Discussion (0)

Sign in or join free to ask questions and discuss this topic.