Raymond Hettinger <[email protected]> added the comment:
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()
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue46757>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com