01 — structure by indentation
The whitespace IS the program — readability enforced by the parser.
for port in ["osaka", "genoa"]:
if port == "osaka":
print("next stop:", port.title())§ 02 — Eras · 1991
executable pseudocode that ate the world
Left: era context, features, and the 101 hello. Right: 3 core concepts, 3 deeper 201 lessons, the factorial specimen, and where Python lives today — each column scrolls on its own.
Teaching and scripting needed one language readable enough to feel like pseudocode but real enough to ship.
The GIL — one thread of Python at a time — plus an interpreter pace it spent thirty years apologizing for.
Session one is the smallest program that still counts as speaking Python: what every tutorial prints first, in the dialect that mattered when the language arrived (1991).
print("Hello, world")101First contact — hello world and 3 ideas that define how Python reads. 201 — 3 lessons on mechanisms you meet after the factorial specimen: the sharp edges practitioners actually use.
3 fragments, each naming a habit of mind in Python. Read the note, then the code — together they are the 101 in one sitting.
01 — structure by indentation
The whitespace IS the program — readability enforced by the parser.
for port in ["osaka", "genoa"]:
if port == "osaka":
print("next stop:", port.title())02 — comprehensions
Map and filter, written the way you would say them.
wages = {"perch": 24, "sundial": 31}
raised = {k: v + 5 for k, v in wages.items()}03 — with blocks
Context managers: setup and teardown tied to scope — RAII, borrowed.
with open("crew.txt") as f:
for line in f:
print(line.strip())The 201 assumes you have read the 101 and the specimen. Each lesson is one mechanism — what it is for, how it looks in code, and the trap or payoff that makes Python distinctive at scale.
A generator is a function that yields; the protocol is so small that lists, dictionaries, files and generators all feed the same for loop.
def fib():
a, b = 0, 1
while True:
yield a
a, b = b, a + b
for n in fib():
if n > 100: breakA decorator is a function that wraps another; a context manager guarantees cleanup. Both are protocols — plain objects with the right methods.
@contextmanager
def open_db(dsn):
conn = connect(dsn)
try:
yield conn
finally:
conn.close()The class protocol runs on plain functions: __get__, __set__, __call__. dataclasses use it to turn declarations into working objects.
@dataclass(frozen=True, slots=True)
class Ship:
name: str
tons: int = 0Structure you can see: the indentation is the program — no braces between you and the algorithm, and a standard library with batteries included.
for port in ["osaka", "genoa"]:
print("next stop: %s" % port)runpython3 fact.py
Every AI framework, most data science, vast swaths of the web’s backends — and it taught more programmers than any language in history.