Message413690
Note that adding an empty __post_init__ method would be a breaking change. The following prints out 'B' then 'C'. But if class A adds an empty __post_init__, then 'B' never gets printed. The arrangement relies on class A being a passthrough to class B.
from dataclasses import dataclass
@dataclass
class A:
pass
@dataclass
class B:
def __post_init__(self):
print('B')
@dataclass
class C(A, B):
def __post_init__(self):
super().__post_init__()
print('C')
c = C() |
|
Date |
User |
Action |
Args |
2022-02-22 03:50:24 | rhettinger | set | recipients:
+ rhettinger, eric.smith, NeilGirdhar, veky, sobolevn |
2022-02-22 03:50:24 | rhettinger | set | messageid: <1645501824.42.0.0538275311151.issue46757@roundup.psfhosted.org> |
2022-02-22 03:50:24 | rhettinger | link | issue46757 messages |
2022-02-22 03:50:24 | rhettinger | create | |
|