[New-bugs-announce] [issue32428] dataclasses: make it an error to have initialized non-fields in a dataclass

Eric V. Smith report at bugs.python.org
Tue Dec 26 13:34:08 EST 2017


New submission from Eric V. Smith <eric at trueblade.com>:

For this class:

@dataclass
class C:
   x: int = 0
   y = 0

Generate a TypeError. 'y' is not a field (as defined by @dataclass). It should either be a regular field (by giving it a type annotation) or a ClassVar field.

----------
assignee: eric.smith
components: Library (Lib)
messages: 309065
nosy: eric.smith
priority: normal
severity: normal
status: open
title: dataclasses: make it an error to have initialized non-fields in a dataclass
type: behavior
versions: Python 3.7

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


More information about the New-bugs-announce mailing list