To create fields that should not be included in the generated init method, use field(init=False).
This is convenient for computed attributes.
Example below 👇
from dataclasses import dataclass, field
@dataclass
class Rectangle:
width: int
height: int
area: int = field(init=False)
def __post_init__(self):
self.area = self.width * self.height
👉 @DataScience4
