← the guideThe Web Opens

§ 02 — Eras · 1991

Python

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.

creators
Guido van Rossum, 1991
status
alive (dominant) · AI, science, web, teaching, glue everywhere

The problem it solves

Teaching and scripting needed one language readable enough to feel like pseudocode but real enough to ship.

The problem it carries

The GIL — one thread of Python at a time — plus an interpreter pace it spent thirty years apologizing for.

Key features

indentation as structure
Blocks are indentation — no braces to misplace, and the file reads as it executes.
batteries included
The standard library covers files, JSON, dates, networking and testing out of the box.
duck typing
Objects work by the operations they support, not by a declared type.
comprehensions
Map and filter written as expressions, and fast enough to leave in production code.

101 — hello, world

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).

the first program1991
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.

101 — core concepts

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())

201 — going deeper

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.

  1. iterators and generators
  2. decorators and context managers
  3. descriptors and dataclasses

iterators and generators

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: break

decorators and context managers

A 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()

descriptors and dataclasses

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 = 0

The specimen — factorial

Structure you can see: the indentation is the program — no braces between you and the algorithm, and a standard library with batteries included.

visible structure1991
for port in ["osaka", "genoa"]:
    print("next stop: %s" % port)

Run it today

runpython3 fact.py

Where it is now

Every AI framework, most data science, vast swaths of the web’s backends — and it taught more programmers than any language in history.