advanced9 h 20 min16 lessons

Advanced Python

How Python works underneath, and what that buys you. The data model, descriptors, metaclasses, the MRO, the import system, memory and the GIL, threads and asyncio, performance work, advanced typing, and authoring libraries other people depend on.

by DevFox

Start course

What you will cover

  1. The Data Model and Dunder MethodsThe protocols behind Python's syntax: how len, in, iteration, comparison and arithmetic are all method calls, and how implementing them makes your types behave like built-in ones.35 min
  2. Descriptors and PropertiesWhat property is built from, the descriptor protocol underneath it, and using it deliberately for validation, laziness and computed attributes without turning a class into magic.35 min
  3. Metaclasses and Class CreationWhat happens when a class statement executes, why __init_subclass__ and decorators solve most of what people reach for metaclasses to do, and the narrow cases that genuinely need one.35 min
  4. Attribute Lookup and the MROHow Python finds an attribute, C3 linearisation, what super actually does in cooperative multiple inheritance, and what __slots__ changes about all of it.35 min
  5. The Import SystemFinders, loaders and sys.path; packages and namespace packages; circular imports and the restructuring that fixes them; and deferring an expensive import without hiding it.35 min
  6. Memory, Reference Counting, and Garbage CollectionWhen an object is actually freed, the cycles reference counting cannot collect, weak references, and why measuring memory in Python is harder than it looks.35 min
  7. The GIL and What It Really BlocksWhat the global interpreter lock does and does not prevent, why threads still help for I/O, what free-threaded builds change, and how to choose between the models on evidence.35 min
  8. Concurrency with Threads and Processesconcurrent.futures as the common interface, processes and the pickling constraint, sharing state safely, and the deadlocks that come from getting either wrong.35 min
  9. Asyncio from the Event Loop UpCoroutines, tasks and the loop that drives them, what await actually suspends, and the single blocking call that stalls an entire async application.35 min
  10. Structured Concurrency and CancellationTask groups that cannot leak a task, timeouts that actually stop work, and treating CancelledError as control flow rather than an error to swallow.35 min
  11. Async I/O in AngerAsync context managers and iterators, connection pools, backpressure when producers outrun consumers, and bridging sync and async code without deadlocking.35 min
  12. Performance EngineeringWorking from a profile: algorithmic wins first, then data structures, then the boundary where native code or vectorisation is the honest answer — with the measurement to justify it.35 min
  13. Typing at the Advanced LevelProtocols for structural typing, TypeVar and ParamSpec, overloads, variance, Self, and writing annotations that make a checker prove something rather than nod along.35 min
  14. Writing a Library Others Depend OnDesigning a public surface you can live with: what to expose, deprecation that gives people time, semantic versioning applied honestly, and shipping types with your package.35 min
  15. Distributing and VersioningWheels and source distributions, native dependencies and the platforms they force you to build for, publishing safely, and the supply-chain concerns that come with being a dependency.35 min
  16. Metaprogramming and Its Limitsinspect, ast and code generation; why eval and exec are almost never the answer; and recognising the point where clever machinery costs more than the duplication it removed.35 min