class CompactPoint: __slots__ = ('x', 'y') def __init__(self, x, y): self.x = x self.y = y Use code with caution. Performance Trade-offs : Drastically reduced footprint per instance. Speed : Faster attribute access times.
class Point: __slots__ = ('x', 'y') def __init__(self, x, y): self.x = x self.y = y python 3 deep dive part 4 oop
Protocols (from typing ) define interfaces via without inheritance. class CompactPoint: __slots__ = ('x'
from datetime import timedelta, date