[issue43953] InitVar should not be available on a @dataclass-decorated class

Eric V. Smith report at bugs.python.org
Tue Apr 27 09:22:38 EDT 2021


Eric V. Smith <eric at trueblade.com> added the comment:

I'm not aware of what problems it would cause, but there's no doubt someone who's relying on it.

Since it's a behavior of normal classes, changing it would violate dataclasses desire (not always realized) to have as little impact as possible on the class that it's decorating.

You could add another decorator to do this, or handle it in a __post_init__ function if needed.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43953>
_______________________________________


More information about the Python-bugs-list mailing list