⚡ PEP Speedruns
Python's best ideas — 90 seconds each.
Pick a Python Enhancement Proposal. Get one before / after snippet, one predict-the-output puzzle, one “here's why it matters”. No 60-page rabbit hole, no “just trust me”. The trick lands or it doesn't.
Assignment as an expression — 3 lines become 1.
Walrus operator `:=` lets you assign inside an expression. Cuts the most common 'compute-then-check' pattern from 3 lines to 1. Predict-the-output challenge inside.
Speedrun PEP 572 →Python stays dynamic — but you can opt into typing.
Type hints look like decoration but they unlock mypy, IDE autocomplete, runtime validation via Pydantic, and FastAPI auto-docs. Predict-the-output inside.
Speedrun PEP 484 →Switch statements are a 5% feature. Pattern matching is the 95%.
Python's match / case is structural pattern matching — it destructures + matches at the same time. Predict-the-output inside.
Speedrun PEP 622 →Most of PEP 8 is decoration. Five rules carry the weight.
PEP 8 is 60 pages. Five of those rules are the ones reviewers actually flag. Names, indentation, line length, blank lines, imports — predict-the-output inside.
Speedrun PEP 8 →Generic functions and classes, finally readable.
Python 3.12 added a clean type-parameter syntax — no more `from typing import TypeVar`. Generic functions and classes in one line. Predict-the-output inside.
Speedrun PEP 695 →From 'somewhere on this line' to 'this exact `[0]`'.
Python 3.11 changed how tracebacks render: instead of pointing at a line, they point at the specific token in the expression. Game-changer for one-liners and chained calls.
Speedrun PEP 657 →32 years of GIL — and now an exit door.
Python 3.13 ships an experimental no-GIL build. Pure-Python threads can finally use multiple cores. Two failure modes shipped with it — predict-the-output inside.
Speedrun PEP 703 →Concurrent failures used to hide each other. Not any more.
When three async tasks fail at once, asyncio.gather used to show only one. PEP 654 + except* lets you catch ALL of them — by type, in groups. Predict-the-output inside.
Speedrun PEP 654 →Inline expressions in strings — finally.
f-strings are the fastest, shortest, most-readable way to format strings in Python. Format specs, expressions, alignment — predict-the-output inside.
Speedrun PEP 498 →The cursed quote-switching workaround can finally go.
For 7 years, nesting the same quote style inside an f-string was a SyntaxError. PEP 701 (Python 3.12) fixed it — and added multi-line + backslash support. Predict-the-output inside.
Speedrun PEP 701 →Wrap a function — keep every argument it had.
Pre-PEP-612 decorators collapsed function signatures to *args/**kwargs in the eyes of mypy + IDEs. ParamSpec restored the signature. Predict-the-output inside.
Speedrun PEP 612 →Delegate a whole generator in one line — and skip the boilerplate forever.
yield from delegates to a sub-generator in one line — and forwards send, throw, and return value. It's the layer asyncio.await was built on top of. Predict-the-output inside.
Speedrun PEP 380 →Every async streaming API you've ever used is built on this.
Async def + yield = async generators. Stream HTTP bodies, SSE, paginated DB rows, LLM tokens with one-liner async for loops. Predict-the-output inside.
Speedrun PEP 525 →Concurrent IO without threads, callbacks, or futures soup.
PEP 492 introduced async def and await — the syntax every modern Python async library uses. Concurrency without threads, callbacks, or the @coroutine decorator. Predict-the-output inside.
Speedrun PEP 492 →Resource lifecycles, finally automatic.
The with statement is what makes 'open(file)' safe even when your code raises. PEP 343 is the foundation every modern Python resource-handling library is built on. Predict-the-output inside.
Speedrun PEP 343 →Annotations in, real class out. No boilerplate.
@dataclass synthesises __init__, __repr__, and __eq__ from your field annotations. The Pythonic Data class without 50 lines of boilerplate. Predict-the-output inside.
Speedrun PEP 557 →The Optional import you never have to write again.
Python 3.10 added pipe-syntax for union types — `int | None` instead of `Optional[int]`, `str | bytes` instead of `Union[str, bytes]`. Works in isinstance too. Predict-the-output inside.
Speedrun PEP 604 →Sibling of async generators — pipelines in one expression.
PEP 530 (Python 3.6) lets you use async for inside a list/dict/set comprehension, AND await inside the loop body. Streaming pipelines in one line. Predict-the-output inside.
Speedrun PEP 530 →Subscripts, attribute chains, conditionals — all legal after @.
Pre-3.9, decorators had a restricted grammar — only name or call expressions allowed. PEP 614 lets you write @decorators[0] or @get_decorator(). Predict-the-output inside.
Speedrun PEP 614 →Type-checker-friendly **kwargs, finally.
PEP 692 (Python 3.12) lets you type **kwargs precisely with a TypedDict + Unpack — no more **kwargs: Any. Predict-the-output inside.
Speedrun PEP 692 →Splat-unpacking — one of Python's most-used 1-liners.
PEP 3132 (Python 3.0) added star-unpacking — `first, *middle, last = items`. The single most-used Python idiom you didn't know had a PEP. Predict-the-output inside.
Speedrun PEP 3132 →One builtin replaces `import pdb; pdb.set_trace()` — and tests can mute it.
PEP 553 (Python 3.7) added the breakpoint() builtin — and the sys.breakpointhook seam that lets test suites + IDEs override it. Predict-the-output inside.
Speedrun PEP 553 →A class contract that fails at construction, not at runtime.
PEP 3119 (Python 2.6) added ABCs and @abstractmethod. The fence that stops subclasses shipping without the methods they were supposed to implement. Predict-the-output inside.
Speedrun PEP 3119 →Annotate fields, not just function params.
PEP 526 (Python 3.6) extended type hints from function args to class fields and module globals. The syntax every dataclass + Pydantic model is built on. Predict-the-output inside.
Speedrun PEP 526 →Why speedruns? Most PEP write-ups are pages of motivation + rejected alternatives + bikeshedding. Useful for the original argument, slow if you just want the trick. Each speedrun is one before / after / predict — enough to land the trick, not enough to drown.
More PEPs coming — pull requests welcome via /contact.