Let's build a dictionary!
- Track:
- Python Core, Internals, Extensions
- Type:
- Tutorial
- Level:
- intermediate
- Room:
- Club H
- Start:
- 13:45 on Tuesday, 15 July 2025
- End:
- 17:00 on Tuesday, 15 July 2025
- Duration:
- 180 minutes
Abstract
Dictionaries are one of the most important data structures in Python. We use them all of the time, in a wide variety of ways. But have you ever thought about how you might implement your own dictionary class? In this tutorial, we'll do exactly that, creating a simple-but-usable dict. Along the way, we'll talk not only about hash functions, and how to resolve collisions, but also a variety of topics related to Python classes, magic methods, and generators. You'll come out of this tutorial with a deeper understanding of Python's dictionaries -- not just what they are and how they work, but also how various Python mechanisms all combine to give us the dicts that we love.