~/talk

Under the Hood Hacking Python Data Types for Fun and Power

Talkat PythonAsia 2026 · on Sunday, 2026-03-22· at 14:45· Pardo Hall (Secondary Hall)· [python]
links:none on file
slides:none on file

Shows how to make a Python list usable as a dict key by implementing __hash__ and __eq__ (example uses an MD5-based integer hash), how to make sets indexable and sliceable via __getitem__ (including using date objects as indices), how to mutate frozen dataclasses with object.__setattr__ and even alter tuple contents by writing into C-level memory, and how generators act as coroutines via generator.send() (used to build a scheduler and a rolling average). Notes the power and the serious risk of corrupting invariants.

AI-written summary · about

  1. 0:00Introduction
  2. 1:12Python data types basics
  3. 3:42Everything is an object
  4. 6:38Dunder methods backbone
  5. 8:25Custom data types
  6. 11:09Hashable lists for keys
  7. 13:21Indexable and slicable sets
  8. 16:34Non-integer key indexing
  9. 18:26Mutating frozen data classes
  10. 20:11Mutating tuples memory
  11. 22:00Generators and async basics
  12. 24:51Rolling average generator
  13. 25:36Hashability and dunder lessons
  14. 26:20Immutability contract
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.