The Mighty Dictionary

One of pythons strongest built-in data type is the dictionary. You can find it everywhere - from a simple key-value store, to a piece of a complex data structure, and all the way down to one of the basic building block of python’s attribute access mechanism.

It’s probably one of the most important data structures in python, and as such, one needs to understand it.

The Mighty Dictionary

How do dictionaries work? What do they do better than other container types, and where, on the other hand, are their weaknesses?

This talk, given at PyCon 2010, aims to train the Python developer’s mind to picture what the dictionary is doing in just enough detail to make good decisions -

  • As data sets get larger
  • About when to use dictionaries
  • When other data structures might be more appropriate

The Dictionary Even Mightier

A follow up to “The Mighty Dictionary” talk from PyCon 2010. Since that talk was given, the dictionary has evolved dramatically.

This talk, given at PyCon 2017, aims to teach about all of the the improvements, up to and including the re-architecture that has landed with Python 3.6 -

  • Iterable views: the dictionary’s dedicated comprehension syntax
  • Random key ordering: the special key-sharing dictionary designed to underlie object collections,
  • The new “compact dictionary” that cuts dictionary storage substantially — and carries a fascinating side-effect - ordered insertions.

Each new feature that the talk discusses is motivated by considering the trade-offs inherent in hash table data structure design, and followed up with hints about how one can use the dictionary even more effectively in his own code.

Modern Python Dictionaries

Python’s dictionaries are stunningly good. Over the years, many great ideas have combined together to produce the modern implementation in Python 3.6.

This fun talk, given at PyCon 2017, uses pictures and little bits of pure python code to explain all of the key ideas and how they evolved over time.

Good Reads

Python Attributes and Methods is the second part of a series that explains about python’s type system (the first is Python Types and Objects). It covers the mechanics of attribute access for new-style Python objects:

  • How functions turn into methods
  • How descriptors & properties work
  • Class method resolution order

I also recommend reading: