Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

dataclass post init

@dataclass
class C:
    a: float
    b: float
    c: float = field(init=False)

    def __post_init__(self):
        self.c = self.a + self.b
Source by docs.python.org #
 
PREVIOUS NEXT
Tagged: #dataclass #post #init
ADD COMMENT
Topic
Name
6+1 =