We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f5166d1 commit 4110471Copy full SHA for 4110471
Doc/library/dataclasses.rst
@@ -536,16 +536,14 @@ class :meth:`~object.__init__` methods. If the base class has an :meth:`~object.
536
that has to be called, it is common to call this method in a
537
:meth:`__post_init__` method::
538
539
- @dataclass
540
class Rectangle:
541
- height: float
542
- width: float
+ def __init__(self, height, width):
+ self.height = height
+ self.width = width
543
544
@dataclass
545
class Square(Rectangle):
546
side: float
547
- height: float = field(init=False)
548
- width: float = field(init=False)
549
550
def __post_init__(self):
551
super().__init__(self.side, self.side)
0 commit comments