[issue33094] dataclasses: ClassVar attributes are not working properly

Adrian Stachlewski report at bugs.python.org
Sun Mar 18 22:38:07 EDT 2018


Adrian Stachlewski <adrian.stachlewski at gmail.com> added the comment:

Thanks for explaining. I was trying to do something like

@dataclass
class A:
  x: ClassVar = set()

and thanks to you I know it should be 

@dataclass
class A:
  x: ClassVar[Set] = set()

If you are looking for improved error message, it's probably should be somehow connected to not proper usage of annotation. I've ended with default_factory because x: ClassVar = set() wasn't working and there was no error with default_factory and without slots.

----------

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


More information about the Python-bugs-list mailing list