[issue44365] Bad dataclass post-init example

2021-10-31 Thread da2ce7
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

[issue44365] Bad dataclass post-init example

2021-10-31 Thread da2ce7
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.

[issue44365] Bad dataclass post-init example

2021-10-31 Thread da2ce7
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