4331 shaares
![](https://realpython.com/cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/SciPy-Tutorial_Watermarked_1.b9f391570601.jpg)
The other day, while working on fpdf2,
I used @dataclass
,
a nice decorator that came in the standard library with Python 3.7,
to quickly define a class
that mostly stored data.
Then a question came to my mind: is the __slots__
memory optimization compatible with …