Python Tip #298 (of 365): When creating lots of class instances, save memory wit...
Trey Hunner ๐ @treyhunner@mastodon.social
Python Tip #298 (of 365):
When creating lots of class instances, save memory with __slots__.
class Point:
__slots__ = ("x", "y", "z")
def __init__(self, x, y, z):
(self.x, self.y, self.z) = (x, y, z)
๐งต (1/3)