Understand __slots__ in Python
A simple way to improve your Python code
Published in
6 min readMay 31, 2020
When we create an object from a class, the attributes of the object will be stored in a dictionary called __dict__
. We use this dictionary to get and set attributes. It allows us to dynamically create new attributes after the creation of the object.