from dataclasses import dataclass
@dataclass(slots=True)
class Base:
def __post_init__(self):
pass
@dataclass(slots=True)
class Thing(Base):
a: int
b: int
c: int = 0
def __post_init__(self):
self.c = self.a + self.b
super().__post_init__()
t = Thing(1,3)
Traceback (most recent call last):
File "C:\Users\michael.foord\Code\one-touch-switch-service\example.py", line 18, in <module>
t = Thing(1,3)
^^^^^^^^^^
File "<string>", line 6, in __init__
File "C:\Users\michael.foord\Code\one-touch-switch-service\example.py", line 16, in __post_init__
super().__post_init__()
^^^^^^^
TypeError: super(type, obj): obj must be an instance or subtype of type