This will help ensure we are correctly accessing fields that are explicitly declared. It also has memory footprint implications since the interpreter avoids creating a dictionary to maintain the state of the objects.
Where available, I configured the @dataclass decorator to automatically generate the __slots__ attribute. In the few other places where we weren't using @dataclass, I declared the slots explicitly.
This will help ensure we are correctly accessing fields that are explicitly declared. It also has memory footprint implications since the interpreter avoids creating a dictionary to maintain the state of the objects.
Where available, I configured the
@dataclass
decorator to automatically generate the__slots__
attribute. In the few other places where we weren't using@dataclass
, I declared the slots explicitly.