(original) (raw)

On 21.12.2017 11:22, Terry Reedy wrote:

@dataclass
class C:
a: int # integer field with no default
b: float = 0.0 # float field with a default

And the types will be recognized by type checkers such as mypy.

And I think the non-typed examples should go first in the docs.


I still don't understand why "I don't care" can be defined by "leaving out"

@dataclass
class C:
b = 0.0 # float field with a default


For non-default fields, I like ellipsis too.

Cheer,
Sven