HackerTube
HomeLongsLikedHistoryWatch laterCategoriesPlaylistsSettings

Modern Dictionaries by Raymond Hettinger

SF Python9 HN recommenders · recommended in 9 months, 2016-2025
YouTube
150K views · 9 years ago · talk · evergreen

Python core developer Raymond Hettinger explains how Python's dictionary implementation evolved into the compact, ordered dict in Python 3.6. He uses pictures and small bits of pure Python, and covers key-sharing, compaction and versioning.

HN treats it as the definitive, engaging talk on hash table internals and Python dict ordering, and recommends it in tech-talk lists.

Python, Ruby & scripting languagesAlgorithms & data structures#python#hashtables#dict#cpython#datastructures

17 comments from Hacker News

@aewens2025 · in “A “frozen” dictionary for Python”

I think Raymond Hettinger is called out specially here because he did a well known talk called [Modern Dictionaries]( ▶ this video ) where around 32:00 to 35:00 in he makes the quip about how younger developers think they need new data structures to handle new problems, but eventually just end up recreating / rediscovering solutions from the 1960s. “What has been is what will be, and what has been done is what will be done; there is nothing new under the sun.”

CitesView on HN
@Spivak2025 · in “Are Python Dictionaries Ordered Data Structures?”

The python dict() is already high-quality and high-performance. You're probably not going to be able to do much better than the current state. If you want faster you end up moving your data into an environment that lets you make more assumptions and be more restrictive with your data and operate on it there. It's how numpy, polaris, and pandas work. Everything in Python is a dict, there's no data structure that's been given more attention. ▶ this video

CitesView on HN
@Rendello2024 · in “Every change breaks someone's workflow (2013)”

I was going to make a tongue-in-cheek suggestion about randomizing undefined behaviour, but I suppose that's common in debugging and even seen in some APIs. At one time, in Python, dictionary (hashmap) ordering was randomized so users wouldn't rely on non-specified ordering behaviour. Eventually though, dictionaries were guaranteed insertion ordering. ▶ this video

CitesView on HN
@quelltext2024 · in “Hash Ordering and Hyrum's Law”

This implementation was used from 3.6, right? It's interesting that the idea mail mentions that nothing changes about the implementation (including order) but the memory layout. Which would imply insertion order was already preserved in older versions (not the case IIRC) or the idea underwent a few more changes that did in fact impact order. EDIT: I couldn't quite find an answer but link mentions the behavior happens since then because the implementation only tracks indices in the hash table itself and relies on maintaining entries separately in a second array that gets expanded in insertion order. This would also seem straightforward but it raises a few questions such as how deletion is implemented (efficiently). EDIT2: Okay, the talk ( ▶ this video ) mentions they just leave holes until the next resize (at around 42:00). Raymond also mentions there that his original idea didn't preserve ordering but happened due to an additional compacting optimization? Should probably watch the whole thing some time to get the history. Sounds like a fun talk.

CitesView on HN
@samwho2023 · in “Hashing”

You're welcome! I deliberately didn't go in to that for a few reasons. 1. It would have made this article very, very long. 2. It's a bit out of scope for an article on hashing. 3. I think I might give hash maps their own article in future. Hash maps are fantastically deep. So many different ways to do it. You'll find a lot of material online but I'd recommend Raymond Hettinger's talk on how Pythons hash map data structure has evolved over time: ▶ this video .

RecommendsView on HN
@AndrewOMartin2022 · in “Pre-Allocated Lists in Python”

▶ this video Modern Dictionaries by Raymond Hettinger The official description of this talk is below, but personally, I'd watch any video with "Raymond Hettinger" in the title. > 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 is given by Raymond Hettinger, the Python core developer responsible for the set implementation and who designed the compact-and-ordered dict implemented in CPython for Python 3.6 and in PyPy for Python 2.7. He will use pictures and little bits of pure python code to explain all of the key ideas and how they evolved over time. He will also include newer features such as key-sharing, compaction, and versioning. This talk is important because it is the only public discussion of the state of the art as of Python 3.6. Even experienced Python users are unlikely to know the most recent innovations.

Strongly recommendsView on HN
@yuy9106162021 · in “Flask 2.0”

3.6 had a couple of big improvement - f strings, annotation, and if I'm not mistaking, the devs did something to improve the dictionaries; from 3.6 on dicts are ordered. I don't know too much about it but raymond hettinger gave a talk about it. ▶ this video

CitesView on HN
@pansa22020 · in “Python Hash Tables: understanding dictionaries”

The talks by Brandon Rhodes are these two: * The Mighty Dictionary (PyCon 2010): link * The Dictionary Even Mightier (PyCon 2017): link There's also one by Raymond Hettinger, which seems to have been given first at a meetup and then, in shorter form, at PyCon 2017: * Modern Dictionaries: ▶ this video * Modern Python Dictionaries - A confluence of a dozen great ideas (PyCon 2017): link

CitesView on HN
@crashbunny2020 · in “Python dicts are now ordered”

Raymond Hettinger does or did a few talks on dictionaries too. He covers the history of dictionaries in python and how they evolved. It was mentioned in the article's comment section. ▶ this video

RecommendsView on HN
@bbrik2020 · in “Python dicts are now ordered”

As far as I know, it was implemented by Raymond Hettinger. This is a very interesting talk about the new tech: ▶ this video

RecommendsView on HN
@StreakyCobra2019 · in “Comprehensive Python Cheatsheet (2018)”

I think this behavior will only be working starting from Python 3.6, as the dictionary obtained by calling `dict.fromkeys()` before this would not keep the ordering [1] [1] ▶ this video

CitesView on HN
@StreakyCobra2018 · in “Ask HN: What are some of the best technical talks you've heard?”

I don't know if it is part of the bests, but very interesting anyway: Modern Dictionaries by Raymond Hettinger [1] It's about Python 3.6 dictionaries improvements. [1] ▶ this video

RecommendsView on HN
@maxnoe2018 · in “Python 3 at Facebook”

Actually they optimized the hashmap, and it turned out a side effect of the optimization was insertion order. First implemented in pypy, then ported to cpython 3.6. Talk by Raimond Hettinger about the new implementation with several other implementations: ▶ this video

RecommendsView on HN
@svieira2018 · in “Ask HN: What is your favourite tech talk?”

Python dictionaries: A Confluence of Great Ideas (also known as Modern Dictionaries) by Raymond Hettinger ▶ this video

Strongly recommendsView on HN
@StreakyCobra2018 · in “Migrating to Python 3 with pleasure”

This has been changed in Python 3.6 only, due to a change in dictionary implementation to make them more efficient. "Modern Dictionaries by Raymond Hettinger" [1] is a quite interesting and technical talk about these changes, explaining also the change in iteration order IIRC, worth a watch in my opinion! [1] ▶ this video

RecommendsView on HN
@Dowwie2017 · in “I Wrote My Fastest Hashtable”

Raymond Hettinger made an interesting talk about Python's dict (hash table) and how Python's core development team evolved it over time. He's giving the polished version of talk at PyCon this May but if you can't wait for it, here's a rough version: ▶ this video

RecommendsView on HN
@tomnipotent2016 · in “Hash tables with open addressing”

Raymond Hettinger gave a presentation a few weeks ago on the evolution of the Python dict implementation - one of the most insightful videos I've seen in a long time. ▶ this video

Strongly recommendsView on HN
Raymond Hettinger - Dataclasses:  The code generator to end all code generators - PyCon 201845:08

Raymond Hettinger - Dataclasses: The code generator to end all code generators - PyCon 2018

PyCon 2018
130K views • 8 years ago
Transforming Code into Beautiful, Idiomatic Python48:51

Transforming Code into Beautiful, Idiomatic Python

Next Day Video
1.1M views • 13 years ago
The Mental Game of Python - Raymond Hettinger1:10:00

The Mental Game of Python - Raymond Hettinger

SF Python
131K views • 7 years ago
Raymond Hettinger, Keynote on Concurrency, PyBay 20171:13:53

Raymond Hettinger, Keynote on Concurrency, PyBay 2017

SF Python
161K views • 9 years ago
Keynote - Preventing, Finding, and Fixing Bugs On a Time Budget | Raymond Hettinger @ PyBay201840:01

Keynote - Preventing, Finding, and Fixing Bugs On a Time Budget | Raymond Hettinger @ PyBay2018

SF Python
27K views • 8 years ago
The Mental Game of Python - Raymond Hettinger [synced version]1:10:00

The Mental Game of Python - Raymond Hettinger [synced version]

Tech Ma
24K views • 6 years ago
How Python was Shaped by leaky Internals, Armin Ronacher, Flask framework49:55

How Python was Shaped by leaky Internals, Armin Ronacher, Flask framework

Видео с мероприятий {speach!
20K views • 10 years ago
Abseil's Open Source Hashtables: 2 Years In - Matt Kulukundis - CppCon 201954:01

Abseil's Open Source Hashtables: 2 Years In - Matt Kulukundis - CppCon 2019

CppCon
22K views • 7 years ago
Cory Benfield - Building Protocol Libraries The Right Way - PyCon 201631:38

Cory Benfield - Building Protocol Libraries The Right Way - PyCon 2016

PyCon 2016
15K views • 10 years ago
High-performance Tree Wrangling, the APL Way // Aaron Hsu // Dyalog '1830:37

High-performance Tree Wrangling, the APL Way // Aaron Hsu // Dyalog '18

Dyalog User Meetings
6K views • 7 years ago
Keynote: Begin...End?57:05

Keynote: Begin...End?

David Beazley
9K views • 5 years ago
Three Beautiful Quicksorts53:56

Three Beautiful Quicksorts

Google TechTalks
45K views • 19 years ago
Q&A with Guido van Rossum, Inventor of Python56:55

Q&A with Guido van Rossum, Inventor of Python

Microsoft Reactor
28K views • 5 years ago
Understanding the Python GIL46:10

Understanding the Python GIL

David Beazley
127K views • 14 years ago
Advanced Topics in Programming Languages: A Lock-Free Hash Table58:36

Advanced Topics in Programming Languages: A Lock-Free Hash Table

GoogleTalksArchive
29K views • 14 years ago
CppCon 2017: Matt Kulukundis “Designing a Fast, Efficient, Cache-friendly Hash Table, Step by Step”59:34

CppCon 2017: Matt Kulukundis “Designing a Fast, Efficient, Cache-friendly Hash Table, Step by Step”

CppCon
137K views • 9 years ago
Armin Ronacher - A Python for Future Generations42:44

Armin Ronacher - A Python for Future Generations

EuroPython Conference
6K views • 9 years ago
David Beazley - Lambda Calculus from the Ground Up - PyCon 20193:26:34

David Beazley - Lambda Calculus from the Ground Up - PyCon 2019

PyCon 2019
52K views • 7 years ago
Invited Talk - Guy Steele1:07:22

Invited Talk - Guy Steele

ClojureTV
39K views • 9 years ago
Google Developers Day US - Python Design Patterns44:03

Google Developers Day US - Python Design Patterns

GoogleDeveloperDay
90K views • 19 years ago