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
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to