Saturday 4:30 p.m.–5 p.m.

Slot or not: higher performance custom objects in pure Python

Aaron Hall


`__slots__` are versatile for certain kinds of uses and users, if you know how they work. At first glance, they seem like a free lunch, with improvements in both time and space. At second glance, they seem to have so many caveats to make them not worth using. This talk is a deep dive into how `__slots__` work, how to wring every benefit out, as well as the actual caveats and alternatives, with recommendations for writers of core libraries as well as end users.