Part 3 · Section 09

Specialized Dictionaries

A plain dict covers most needs, but a few patterns come up so often that the standard library ships ready-made dictionaries for them: a dictionary that fills in missing keys for you, one that counts things, one that layers several mappings on top of each other, and a base class for writing your own dictionary types safely. All of them live in the collections module.

In this section you’ll learn:

Lectures

  1. 01Defaultdict✓
  2. 02OrderedDict✓
  3. 03OrderedDict vs Plain Dict✓
  4. 04Counter✓
  5. 05ChainMap✓
  6. 06UserDict✓

Practice: quiz & exercises

12 quiz questions · 4 coding exercises

Go to practice →