da2ce7 added the comment:
I have made a slightly more comprehensive example. See file attached.
Please consider for the updated documentation.
--
nosy: +da2ce7
Added file: https://bugs.python.org/file50414/dataclass_inheritance_test.py
___
Python
da2ce7 added the comment:
Upon Self Review, I think that this slightly updated version is a bit more
illustrative.
--
Added file: https://bugs.python.org/file50415/dataclass_inheritance_v2_test.py
___
Python tracker
<https://bugs.python.
da2ce7 added the comment:
Amazingly, the original example needs a very small change to make it work as
expected:
@dataclass
class Rectangle:
height: float
width: float
@dataclass
class Square(Rectangle):
side: float
height: float = field(init=False)
width: float = field