PyPython

Python glossary – key terms explained

Context manager

An object for with blocks that encapsulates setup and cleanup (__enter__/__exit__).

Decorator

A function that wraps and extends another function; applied with @name.

Dictionary

A collection of key-value pairs with very fast access by key.

Duck typing

"If it walks like a duck and quacks like a duck…" – what matters is which methods an object has, not its class.

Dunder method

A special method with double underscores such as __init__ or __str__ that Python calls automatically.

Generator

A function with yield that delivers values one after another on demand.

GIL

Global Interpreter Lock: a lock in CPython that ensures only one thread executes bytecode at a time.

Interpreter

A program that executes Python code line by line (more precisely, as bytecode).

Iterable

Anything you can loop over with for: lists, strings, dictionaries, generators …

List comprehension

A compact notation for creating lists from other collections: [x*2 for x in l].

PEP 8

The official style guide for Python code (4 spaces, snake_case for names, etc.).

PyPI

Python Package Index – the central repository from which pip installs packages.

Type hint

An optional type annotation like def f(x: int) -> str that tools such as mypy check.

Virtual environment

An isolated folder with its own Python installation and packages per project (python -m venv).