Skip to content

Python Deep Dive Textbook

A free, self-paced textbook in 8 chapters. Read a chapter, then drill it with the 263 companion flashcards using spaced repetition.

8 chapters · 263 cards · Updated

Chapters

  1. 1Python Foundations and Principles

    Python is a high-level, interpreted, dynamically typed language created by Guido van Rossum in 1991. The language is shaped by PEP 8, its official style guide, and PEP 20, Tim Pete...

  2. 2Core Data Types and Type Concepts

    Python's dynamic type system relies on behavior-based dispatch, a property known as duck typing: rather than checking declared types, code asks whether an object can perform a requ...

  3. 3Iteration, Generators, and Comprehensions

    Python distinguishes iterables — objects that can return an iterator via `__iter__` — from iterators, which implement both `__iter__` and `__next__`. When an iterator is exhausted,...

  4. 4Functions, Decorators, and Modules

    Functions are first-class objects that can be wrapped to modify behavior through decorators. The `@decorator` syntax above a definition is syntactic sugar equivalent to `f = decora...

  5. 5Object-Oriented Programming and Dunder Methods

    Python integrates objects with language syntax through dunder (double underscore) methods. `__init__` initializes a newly created instance, while `__new__` actually creates and ret...

  6. 6Type Hinting and Modern Language Features

    PEP 484 introduced optional type annotations specifying expected types, supported by the `typing` module which provides generics like `List`, `Dict`, `Optional`, `Union`, and `Call...

  7. 7Concurrency: GIL, Threads, Processes, and Async

    CPython's Global Interpreter Lock (GIL) ensures that only one thread executes Python bytecode at a time, simplifying memory management but limiting CPU-bound multithreading paralle...

  8. 8Standard Library, Tooling, and Ecosystem

    Python's standard library is extensive. The `collections` module adds specialized containers: `namedtuple` creates tuple subclasses with named fields, `OrderedDict` maintains inser...

← Back to the Python Deep Dive deck