[Python-Dev] Is static typing still optional?

Ivan Levkivskyi levkivskyi at gmail.com
Tue Dec 26 18:43:42 EST 2017


On 22 December 2017 at 20:55, Brett Cannon <brett at python.org> wrote:

>
>
> On Fri, Dec 22, 2017, 11:38 Chris Barker, <chris.barker at noaa.gov> wrote:
>
>> On Fri, Dec 22, 2017 at 8:49 AM, Brett Cannon <brett at python.org> wrote:
>>
>>> I  think it's worth reminding people that if they don't like the fact
>>>> dataclasses (ab)use type hints for their succinct syntax that you can
>>>> always use attrs instead to avoid type hints.
>>>>
>>>
>> sure -- but this doesn't really address the issue, the whole reason this
>> is even a discussion is because dataclasses is going into the standard
>> library. Third party packages can do whatever they want, of course.
>>
>> And the concern is that people (in particular newbies) will get confused
>> / the wrong impression / other-negative-response by the (semi) use of
>> typing in a standard library module.
>>
>
> I'm still not worried. Type hints are part of the syntax and so are no
> worse off than async/await and asyncio IMO.
>
>
>>
>>> As for those who feel dataclasses will force them to teach type hints
>>> and they simply don't want to, maybe we could help land protocols
>>>
>>
>> Could you please clarify what this is about ???
>>
>
> There's a PEP by Ivan (on my phone else I would look up the number).
>
>
If anyone is curious this is PEP 544. It is actually already fully
supported by mypy, so that one can play with it
(you will need to also install typing_extensions, where Protocol class
lives until the PEP is approved).

--
Ivan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20171227/48a02c62/attachment.html>


More information about the Python-Dev mailing list