Contribute Media
A thank you to everyone who makes this possible: Read More

Slots, slots, slots, everybody: an exploration of __slots__


Python's backbone is its dictionaries but, in some cases, these dictionary instances that objects use to store its attributes can take up too much memory. Luckily Python's fantastic data model provides a way to solve this by using tuples to store an object's instances variables: __slots__.


Improve this page