Skip to content

Tag: python-dataclasses

Annotate dataclass class variable with type value

We have a number of dataclasses representing various results with common ancestor Result. Each result then provides its data using its own subclass of ResultData. But we have trouble to annotate the case properly. We came up with following solution: but it stopped working lately with mypy error ClassVar canno…