[issue33539] Remove `init` flag from @dataclass?

Eric V. Smith report at bugs.python.org
Wed May 16 16:09:21 EDT 2018


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

I think the concern is:

from dataclasses import *

class B:
    def __init__(self, a, b, c):
        # do something with a, b, c, and maybe use fields(self) to figure out we have a "i" field
        self.i = a + b + c

@dataclass(init=False)
class C(B)
    i: int

c = C(1, 2, 3)

It doesn't seem particularly likely, but do we want to prevent it?

----------

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


More information about the Python-bugs-list mailing list