The Glossary of Python
Core Concepts
Interpreter — The program that reads Python source code and executes it directly, rather than compiling it ahead of time into a standalone binary; CPython is the reference implementation most people mean when they say "Python."
PEP (Python Enhancement Proposal) — The formal design document format Python uses to propose, discuss, and record decisions about new language features — PEP 8 (style), PEP 20 (the Zen of Python), and PEP 484 (type hints) are among the most cited.
Indentation — Python's mechanism for marking code blocks, using consistent whitespace instead of braces — a deliberate design choice that makes structure and readability part of the syntax itself, not just a convention.
Duck Typing — Python's informal approach to types: an object's suitability for an operation is judged by whether it supports the right methods and behavior, not by its declared type — "if it walks like a duck and quacks like a duck."
Dynamic Typing — The property that variable types are checked at runtime rather than compile time, so a name can be rebound to a value of a different type at any point in a program.
Object — Everything in Python — numbers, strings, functions, classes, modules — is an object, meaning it has an identity, a type, and a value, and can be passed around, inspected, and extended uniformly.
Mutable / Immutable — A distinction between objects whose contents can change in place after creation (lists, dicts, sets) and those that cannot (numbers, strings, tuples) — a distinction that quietly governs how Python handles assignment, function arguments, and hashing.
Namespace — A mapping from names to objects, used to keep identifiers separate across contexts (a module, a function's locals, a class) — the reason two functions can each have their own variable called x without conflict.
Scope (LEGB Rule) — The order Python searches namespaces to resolve a name: Local, Enclosing, Global, then Built-in — determining which x a piece of code actually refers to.
Data Structures
List — An ordered, mutable sequence of items, Python's default general-purpose container, written with square brackets and resizable after creation.
Tuple — An ordered, immutable sequence, often used for fixed collections of values or as dictionary keys and function return values where mutability isn't wanted.
Dictionary (dict) — An unordered (in earlier versions) or insertion-ordered (since 3.7) mapping of hashable keys to values, Python's built-in hash table, central to how the language itself represents objects, namespaces, and keyword arguments internally.
Set — An unordered collection of unique, hashable elements, optimized for fast membership testing and mathematical operations like union and intersection.
Comprehension — A concise syntax for building a list, dict, or set by looping and optionally filtering in a single expression — [x**2 for x in range(10) if x % 2 == 0] — favored in idiomatic Python over equivalent for loops.
Slicing — The [start:stop:step] syntax for extracting a sub-portion of a sequence, working on lists, tuples, strings, and any object that implements the sequence protocol.
Iterable — Any object capable of returning its elements one at a time, meaning it implements __iter__; the basis for for loops, comprehensions, and unpacking.
Iterator — An object that produces successive values via __next__ and raises StopIteration when exhausted — the actual mechanism for loops rely on under the hood, distinct from the iterable that creates it.
Generator — A function that uses yield instead of return to produce a sequence of values lazily, one at a time, without holding the whole sequence in memory at once.
Unpacking — Assigning the elements of an iterable to multiple variables in one statement (a, b, c = [1, 2, 3]), including the star syntax (*rest) for capturing variable-length remainders.
Functions & Object-Oriented Python
Function — A reusable, named block of code defined with def, which can accept arguments, return a value, and — because functions are themselves objects — be passed around like any other value.
args / *kwargs — The conventional syntax for accepting a variable number of positional arguments (*args, collected as a tuple) and keyword arguments (**kwargs, collected as a dict) in a function signature.
Lambda — An anonymous, single-expression function defined inline with the lambda keyword, typically used for short throwaway callbacks like sort keys.
Decorator — A function that wraps another function (or class) to extend or modify its behavior without changing its source code, applied with the @decorator syntax above a definition.
Closure — A function that remembers and can access variables from the scope in which it was defined, even after that outer scope has finished executing — the mechanism that makes many decorators possible.
Class — A blueprint for creating objects, bundling data (attributes) and behavior (methods) together, defined with class.
self — The conventional name for the first parameter of an instance method, referring to the specific instance the method was called on; Python passes it explicitly rather than making it implicit.
__init__ — The constructor method Python calls automatically when a new instance of a class is created, typically used to set up initial attribute values.
Dunder (Magic) Methods — Methods with double-underscore names (__init__, __str__, __len__, __eq__) that let a custom class hook into Python's built-in syntax and behavior — the reason len(obj) or obj + other can work on user-defined types.
Inheritance — The mechanism by which a class derives attributes and methods from a parent class, enabling code reuse and the modeling of "is-a" relationships.
Property — A way to define methods that behave like attributes on access (@property), letting a class add computed or validated behavior behind what still looks like plain attribute access from the outside.
Metaclass — A "class of a class" — the mechanism that controls how classes themselves are created, an advanced feature most Python code never needs to touch directly.
Errors, Modules & Execution
Exception — An event signaling that something went wrong during execution, raised with raise and handled with try/except blocks, forming Python's primary error-handling mechanism.
try / except / finally — The block structure for catching exceptions (except), running cleanup code regardless of whether an error occurred (finally), and optionally running code only if no exception was raised (else).
Context Manager — An object implementing __enter__ and __exit__ that manages setup and teardown around a block of code, most commonly used through the with statement to guarantee resources like files get closed.
Module — A single .py file containing Python definitions, importable into other files with import to reuse its code.
Package — A directory of related modules, marked (traditionally via an __init__.py file) so it can be imported as a single namespace, letting large codebases organize code hierarchically.
pip — Python's standard package installer, used to fetch and install third-party libraries from the Python Package Index (PyPI).
Virtual Environment (venv) — An isolated Python installation with its own set of installed packages, used to keep a project's dependencies separate from the system Python and from other projects.
__main__ — The name Python assigns to a script when it's run directly (as opposed to imported), commonly checked with if __name__ == "__main__": to separate reusable code from a script's entry point.
The Modern & Concurrent Stack
Type Hints — Optional annotations (def greet(name: str) -> str:) introduced by PEP 484 that document expected types without being enforced by the interpreter at runtime — checked instead by external tools.
mypy / Static Type Checkers — Tools that analyze type-hinted code before it runs to catch type inconsistencies, bringing some of the safety of statically typed languages to Python without changing how it executes.
GIL (Global Interpreter Lock) — A mutex in CPython that allows only one thread to execute Python bytecode at a time, historically limiting true CPU-bound parallelism via threads and shaping why multiprocessing and async are common workarounds.
asyncio — Python's standard library framework for writing single-threaded concurrent code using async/await, well suited to I/O-bound work like network requests where a program spends most of its time waiting.
async / await — The keywords for defining a coroutine (async def) and pausing it to hand control back to the event loop until an awaited operation completes (await), without blocking the rest of the program.
Coroutine — A special function that can suspend and resume its execution at defined points, the building block asyncio runs concurrently on a single thread.
Multiprocessing — A standard library module for running code across multiple separate processes rather than threads, sidestepping the GIL to achieve genuine parallelism for CPU-bound tasks.
Free-Threaded Python — An experimental build of CPython (available from 3.13 onward) that can run without the GIL, allowing true multi-threaded parallelism — an active area of change in how Python handles concurrency.
f-string — Formatted string literals (f"Hello, {name}"), introduced in Python 3.6, that embed expressions directly inside string constants and are now the idiomatic way to format strings.
Walrus Operator (:=) — An assignment expression, introduced in Python 3.8, that lets a value be assigned and used within the same expression — for example, inside a while loop condition.
Structural Pattern Matching — The match/case statement introduced in Python 3.10, allowing code to branch based on the shape and content of a value, similar in spirit to switch statements in other languages but considerably more expressive.
Ecosystem & Tooling
PyPI (Python Package Index) — The official public repository of third-party Python packages, the default source pip installs from.
venv / conda / poetry / uv — The family of tools for managing isolated environments and project dependencies, ranging from the lightweight standard-library venv, to conda's broader scientific-package and environment management, to newer, faster dependency managers like poetry and uv.
pytest — The most widely used third-party testing framework for Python, favored over the standard library's unittest for its simpler syntax, fixtures, and plugin ecosystem.
black / ruff — Popular tools for automatically formatting (black) and linting (ruff, which also handles formatting and import sorting) Python code to a consistent style, reducing debate over formatting in code review.
NumPy — The foundational library for numerical computing in Python, providing fast, multi-dimensional array operations implemented in C — the base most of the scientific Python stack is built on.
pandas — A library built on NumPy for working with labeled, tabular data (DataFrames), the standard tool for data cleaning, exploration, and analysis in Python.
Django / Flask / FastAPI — Python's most widely used web frameworks, spanning a spectrum from Django's full-featured, batteries-included approach, to Flask's minimalism, to FastAPI's async-first design built around type hints and automatic API documentation.
Jupyter Notebook — An interactive, browser-based environment for writing and running Python in cells alongside text and visualizations, dominant in data science and research workflows.
Taken together, this glossary traces Python's own throughline: a language built around readability and "one obvious way to do it" that has, over three decades, kept absorbing new problems without abandoning that premise. Comprehensions and generators grew out of a desire for expressive iteration; type hints arrived as codebases got too large to track informally; asyncio and the ongoing move away from the GIL exist because "batteries included" eventually had to include real concurrency. Each term here marks a point where practical pressure met Python's founding taste for simplicity — and mostly, simplicity won.
*written with Claude Sonnet 5