Author eric.smith
Recipients eric.smith, stachel
Date 2018-03-19.01:15:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
There are a couple of problems here. You're using ClassVar incorrectly. It should be:

>>> @dataclass
... class C:
...   __slots__=()
...   x: ClassVar[int] = field(default=3)
>>> C()
>>> C.x

And you cannot have a ClassVar with a default_factory, since it would never get called:

>>> @dataclass
... class C:
...   __slots__=()
...   x: ClassVar[int] = field(default_factory=set)

    raise TypeError(f'field {} cannot have a '
TypeError: field x cannot have a default factory

Although this error message could be improved. Neither InitVars or ClassVars can have default factories.

I'm not exactly sure how to improve the error message that you're seeing.
Date User Action Args
2018-03-19 01:15:57eric.smithsetrecipients: + eric.smith, stachel
2018-03-19 01:15:56eric.smithsetmessageid: <>
2018-03-19 01:15:56eric.smithlinkissue33094 messages
2018-03-19 01:15:56eric.smithcreate