[issue46938] dataclass __post_init__ recursion
Bar Harel
report at bugs.python.org
Sun Mar 6 16:51:20 EST 2022
Bar Harel <bzvi7919 at gmail.com> added the comment:
Actually I'm not sure if the fix is so simple. What happens if B does not inherit from dataclass, but still inherits from A? Do we want to use the new __post_init__? I would assume we do, meaning we don't necessarily want to attach the __post_init__ to the dataclass, but to subclasses.
If so, the suggestion to call __init__() from __post_init__() might be the problematic part, and is what conceptually breaks the inheritance linearization.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46938>
_______________________________________
More information about the Python-bugs-list
mailing list