Simply, if I have base class:
@dataclass
class Base:
foo: int
bar: int
and derived class:
@dataclass
class Derived(Base):
baz: int
I want to do this:
base = Base(1, 2)
derived = Derived(base, 3)
But this would try to assign base to derived.foo. Is there a way to accomplish this in such a way that I don't have to iterate over each field? I could for example serialize base to json, add the additional field, then deserialize to derived but that seems a bit hacky.