[Python-Dev] Is static typing still optional?
Sven R. Kunze
srkunze at mail.de
Thu Dec 21 06:25:41 EST 2017
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20171221/dcef0001/attachment.html>
More information about the Python-Dev
mailing list