[Python-Dev] Is static typing still optional? (original) (raw)

Brett Cannon brett at python.org
Fri Dec 22 14:55:38 EST 2017


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).

-Brett

But I think the key point I want to make is Guido chose dataclasses to support using the type hints syntax specifically over how attrs does things, so I don't see this thread trying to work around that going anywhere at this point since I haven't seen a solid alternative be proposed after all of this debating.

And the PEP has been approved. So the actionable things are: Writing good docs Converging on a "recommended" way to do non-typed dataclass fields. And that should be decided in order to write the docs, (and probably should be in the PEP). -CHB -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE <https://maps.google.com/?q=7600+Sand+Point+Way+NE&entry=gmail&source=g> (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker at noaa.gov -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20171222/f1ed7784/attachment.html>



More information about the Python-Dev mailing list