I have a dataclass
hierarchy:
@dataclass
class A:
x: int
y: int
@dataclass
class B(A):
z: int = 1
Why is it that I can’t create B
using an existing A
directly?
a=A(0,0)
b=B(a) # exception
However, I can use __dict__
a=A(0,0)
b=B(**a.__dict__)
Is there a better way?