Eric V. Smith <e...@trueblade.com> added the comment:
I assume this is the behavior you're seeing: >>> @dataclass ... class C: ... i: int = 0 ... >>> c = C(10) >>> c C(i=10) >>> del c.i >>> c C(i=0) >>> del c.i Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: i >>> If so, that's the expected behavior. You're deleting an instance attribute, so that the class attribute with the same name is seen. This also happens without dataclasses: >>> class C: ... i = 0 ... def __init__(self, i): ... self.i = i ... >>> c = C(10) >>> c.i 10 >>> del c.i >>> c.i 0 >>> del c.i Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: i >>> If you're seeing something different, please re-open this issue. ---------- resolution: -> not a bug stage: -> resolved status: open -> closed _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue34387> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com