Dataclass inheriting using kw_only for all variables
I am practicing on using the super function and dataclass inheritance in general. I have enabled the kw_only attribute for cases when the parent class has default values. I completely understand that super doesn’t need to be used in a dataclass if you’re just passing variables and I can avoid using super here. My goal is to understand the super feature better through this example. I can’t understand the error message I’m getting though.
Derived python dataclass cannot override default value?
In the following code snippet the dataclass Derived
is derived from dataclass Base
. The Derived
dataclass is setting new default values for field1
and field2
.
Inheriting from Python dataclass
I started using dataclasses recently and having some issues understanding how the inheritance works. I can’t understand the problem with too many variables being passed on. Am I using the super() method correctly here?