Skip to content

Python Practice

Master the data model, generators, decorators, and asyncio.

ConceptDetails
Memory ModelReference counting + cycle GC, everything is an object, __slots__
Type SystemDynamic, gradual typing (typing module), protocols, TypeVar
Error HandlingExceptions (try/except/else/finally), ExceptionGroup (3.11+)
Concurrencyasyncio, threading (GIL), multiprocessing, free-threading (3.13+)
Builduv, pip, pyproject.toml, ruff for linting
StandardCPython 3.12+
  • Dunder methods (__init__, __repr__, __iter__) for protocol conformance
  • Generators and yield from for lazy sequences
  • Decorators (function and class) for cross-cutting concerns
  • Context managers (with statement, __enter__/__exit__)
  • Comprehensions (list, dict, set, generator) over explicit loops
  • dataclasses and attrs for structured data
  • Descriptors for attribute access control
  • match statement (3.10+) for structural pattern matching
Terminal window
practice/bin/ol list build python # which of these have references yet
practice/bin/ol start build python 01 # clone it stubbed into .scratchpad/
practice/bin/ol check build python 01 # run it; exit code is the verdict
practice/bin/ol diff build python 01 # your attempt against the reference

Exercises are ordered by concept, not by difficulty, so pick by the stars rather than by the number. An exercise listed below with no reference yet is a row in this table and nothing more; see the practice path for how the harness works.

#ExerciseConceptsDifficulty
01Descriptor-based ORMDescriptors, metaclasses, __set_name__⭐⭐⭐⭐
02Async task schedulerasyncio, event loop, Future, cancellation; course version: lang.08, data.01⭐⭐⭐
03Generator-based pipelineyield, send, throw, coroutine chaining; course version: data.02⭐⭐⭐
04Property-based test frameworkDecorators, inspect, random generation, shrinking; course version: craft.04⭐⭐⭐⭐
05LRU cache with TTL__hash__, __eq__, doubly-linked list, threading.Lock; course version: gw.06⭐⭐⭐
06Import hook (custom loader)importlib, sys.meta_path, ModuleSpec⭐⭐⭐⭐⭐
07Dataclass code generatorast module, metaprogramming, exec⭐⭐⭐⭐
08Actor model (multiprocessing)multiprocessing.Queue, Process, message passing; course version: data.04⭐⭐⭐
09Type checker (subset)typing, AST walking, unification algorithm⭐⭐⭐⭐⭐
10WSGI framework (mini-Flask)WSGI spec, decorators, routing, middleware⭐⭐⭐