Message405410
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(init=False)
def __post_init__(self) -> None:
super().__init__(self.side, self.side)
I discover this now, after playing around for a while.
Attached is the simplified version of my expanded example testcase. |
|
Date |
User |
Action |
Args |
2021-10-31 17:30:04 | da2ce7 | set | recipients:
+ da2ce7, eric.smith, docs@python, andrei.avk, MicaelJarniac |
2021-10-31 17:30:04 | da2ce7 | set | messageid: <1635701404.42.0.468242400145.issue44365@roundup.psfhosted.org> |
2021-10-31 17:30:04 | da2ce7 | link | issue44365 messages |
2021-10-31 17:30:04 | da2ce7 | create | |
|