The Python Reference
A proper reference, written like a textbook and ordered exactly like the course. Every concept the ladder teaches — explained in plain English, with worked examples, the mistakes to avoid, and why it matters. Read it cover to cover, or jump to what you need.
First Light
Curious BeginnerThe smallest possible working program, and the four ideas under it: printing, storing values, building text from data, and turning text into numbers.
Logic & Loops
ApprenticeCode that makes decisions and repeats itself — reading errors, branching with if/elif/else, combining conditions, and the two loop shapes (while and for).
Real Tools
Junior DeveloperThe tools that turn scripts into real programs: functions and scope to organise code, and the core data structures — lists, dicts, tuples and sets — to hold the data.
- Functions: def and returndef · return vs print
- Parameters, defaults and keyword argumentsparameters · defaults · keyword args
- Scope and namespacesscope · namespaces
- Loop control: continue, break, and skipping invalid inputfor loop · continue · skipping invalid input
- Built-ins: len, max, min, sum, sortedlen · max · min · sum · sorted
- Composing functions and single responsibilitycomposing functions · single responsibility
- Lists: indexing, slicing, methodslists · indexing · slicing · append/pop/remove · in
- enumerate and building lists in a loopenumerate · build-list-in-loop · filter
- Dictionariesdicts · .get() · .items()
- Tuples, sets and unpackingtuples · sets · unpacking
- List comprehensionslist comprehensions
Touching the World
Mid-level DeveloperReaching past your own code: the standard library, reading and writing files and JSON, calling APIs, keeping secrets in env vars, handling errors, and the two foundations of larger programs — objects (classes) and tests.
- The standard library: random, datetime, pathlibrandom · datetime · pathlib — stdlib tour
- Reading and writing filesopen() · with · read/write modes
- JSON persistencejson.dump · json.load · dict↔file
- Calling an API with requestsrequests.get() · status codes · .json()
- API keys, secrets and environment variablesenv vars · never hardcode secrets · query params
- Error handling: try / except / raisetry/except · raise · specific exceptions
- Your first class: __init__, methods, selfclass · __init__ · methods · self
- Dunders and dataclasses__repr__ · __str__ · @dataclass
- Inheritance and super()inheritance · super() · override
- Writing tests: assert and pytest-stylepytest-style testing · assert · red→green
Working With Data
Data / ML EngineerThe building blocks of a machine-learning pipeline — validating records, engineering features, classifying with rules, measuring with the right metrics, aggregating, and wiring it all into a hand-rolled train→predict→evaluate loop.
- Schema validationvalidate record · required fields · type + range guards
- Validating a batchbatch validation · reject/accept split · error reporting
- Feature engineeringnormalise · bucket · one-hot encode · feature transforms
- Rule-based classifierrule classifier · threshold predict · deterministic ML shape
- Evaluation metricsaccuracy · precision · recall · confusion matrix
- Aggregation pipelinegroup-by · aggregate · sort pipeline
- Train → predict → evaluatethreshold learner · train/test split · evaluate pipeline
Engineering Craft
Senior DeveloperThe advanced pure-Python patterns that separate solid code from senior code — lazy generators, decorators, context managers, asyncio, plugin registries, the LRU cache, and state machines.
- Generators and lazy evaluationgenerators · yield · lazy evaluation · iterator protocol
- Decoratorsdecorators · functools.wraps · higher-order functions · memoization
- Context managers (with)context managers · __enter__ / __exit__ · contextlib · resource cleanup
- asyncio basicsasyncio · async def · await · asyncio.gather · concurrent tasks
- The plugin registry patternplugin registry · decorator registration · dynamic dispatch · extensibility
- LRU cache and data-structure choiceLRU cache · OrderedDict · eviction policy · data-structure trade-offs
- State machinesstate machine · finite automaton · transitions · event dispatch
Building With AI
AI-Curious DeveloperLLM-from-code fundamentals in pure Python: prompting, conversation memory, parsing responses, tool-call dispatch, and JSON guardrails.
- Prompt engineering with string transformsprompt engineering · string transforms · template filling
- System prompts and conversation memorysystem prompt · conversation list · multi-turn structure
- Request → parse → validate (handling an LLM response)request→parse→validate · stubbed LLM · response handling
- Detecting a tool calltool-call detection · intent parsing · string inspection
- Dispatching tool calls (a tool registry)tool dispatch · function registry · tool-use loop
- JSON output guardrails: force and validateJSON output · validate schema · retry on failure
- Parsing structured metadata (git log example)git log parsing · commit metadata · branch reasoning
Automating the Boring Work
Integrations / Automation EngineerThe production-ops patterns that make a script survive the real world: retry with backoff, idempotent re-runs, config-driven dispatch, rate-limiting and batching, dead-letter handling, dependency-ordered pipelines, and deterministic scheduling.
- Retry with exponential backoffretry logic · exponential backoff · delay sequences
- Idempotent operationsidempotency · state guards · safe re-runs
- Config-driven dispatchhandler registry · config dispatch · plugin pattern
- Rate limiting and batchingbatching · rate cap · chunked processing
- Dead-letter handlingerror recovery · dead-letter queue · partial failure
- Step pipelines with dependenciespipeline · dependency order · step chaining
- Scheduling logiccron-style scheduling · deterministic time checks · interval math
AI Engineering
AI EngineerBuilding real AI features in plain Python — few-shot prompting, validated function-calling, embeddings and RAG, an agent loop with guardrails, and evals to prove it works.
- Few-shot and structured promptingfew-shot examples · output schema · prompt assembly
- Robust function-callingargument validation · type coercion · reject bad tool calls
- Embeddings and cosine similaritytext → vector · cosine similarity · ranking by relevance
- A tiny vector storeindex documents · retrieve top-k by similarity · in-memory store
- RAG: grounding answers in retrieved contextretrieve → stuff context → grounded answer · 'I don't know' path
- A minimal agent loopthink → act → observe · feed results back · stop on final answer
- Guardrails for agentsmax-steps cap · allow-list tools · block forbidden actions · audit log
- Evals: scoring model outputeval harness · metric · pass-rate · regression detection
AI Architecture
AI ArchitectThe systems view of an AI product: orchestrating many agents, designing a vector store, modelling pipelines as DAGs, scaling under a concurrency cap, controlling token cost, tracing every step, and designing for the failures that will happen.
- Multi-agent orchestrationcoordinator · agent registry · task routing · result merge
- Vector-DB design and metadata filteringvector store · metadata filter · top-k similarity retrieval
- Pipeline / DAG designDAG · dependencies · topological sort · cycle detection
- Scaling: batching and concurrencybatching · concurrency cap · throughput simulation · completion order
- Cost control and token budgetingtoken estimation · price table · budget enforcement · model-tier downgrade
- Observability and tracingtracer · spans · parent links · trace tree · slowest-span analysis
- Failure-mode designtransient vs permanent · retry · dead-letter · fallback · graceful degradation
Reading Code
ReviewerThe durable skill of reviewing code you didn't write — spotting bugs and edge cases, judging structure, catching security holes, and giving feedback that's specific, kind, and ranked by severity.
- Reading a diff, finding the bugdiff review — spot the off-by-one / wrong operator
- Spotting the missing edge caseedge cases — empty / None / zero guards
- Judging naming and structurebehaviour-preserving refactor — extract a named helper
- Catching the security issuesecurity review — replace eval() of untrusted input
- Writing good review feedbackJUDGE mode — classify each finding (bug/security/style/nit)
Judging AI Code
AI Architect / LeadReviewing and verifying AI-generated code — catching confident-but-wrong logic, hallucinated APIs, insecure patterns and missing tests, then making the accept/reject/revise call with evidence rather than trust.