Expand type coverage in cpython implementation
Hi all, I recently noticed that stdlib functions often don't have type hints. Is there a technical reason why typing isn't more widespread in the cpython implementation? As a developer, it'd be great if I didn't have to wrap many of my stdlib calls in casts to make mypy happy. Please let me know if there's a more appropriate channel for this discussion. I tried looking through the mailing list archives and github issues, but I couldn't find the answer to this. Best, Jared
El mié, 16 mar 2022 a las 3:58, Jared Crawford (
Hi all,
I recently noticed that stdlib functions often don't have type hints. Is there a technical reason why typing isn't more widespread in the cpython implementation?
Mostly there hasn't been agreement to add them. See https://discuss.python.org/t/type-annotations-in-the-standard-library/7309 for a previous discussion.
As a developer, it'd be great if I didn't have to wrap many of my stdlib calls in casts to make mypy happy.
Mypy uses standard library types from the typeshed repo ( https://github.com/python/typeshed) and doesn't look at the stdlib source code. If any of the typeshed types are incomplete, please report an issue there.
Please let me know if there's a more appropriate channel for this discussion. I tried looking through the mailing list archives and github issues, but I couldn't find the answer to this.
Best, Jared _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-leave@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/3W43OK... Code of Conduct: http://python.org/psf/codeofconduct/
Most importantly, static type checking is still immature and as yet there
is no standard for how to say "this thing is an X". Adding type hints into
the stdlib source would force you to choose one (third party) tool,
https://typing.readthedocs.io/en/latest/#type-checkers , which then would
lock you into the design of that tool, promoting it above all others.
Sure, most people would pick mypy, but then what happens to users of any of
the others? Do we want to force the other tools into mypy's philosophy,
thus stunting their potential innovations?
On Wed, Mar 16, 2022 at 3:57 AM Jared Crawford
Hi all,
I recently noticed that stdlib functions often don't have type hints. Is there a technical reason why typing isn't more widespread in the cpython implementation? As a developer, it'd be great if I didn't have to wrap many of my stdlib calls in casts to make mypy happy. Please let me know if there's a more appropriate channel for this discussion. I tried looking through the mailing list archives and github issues, but I couldn't find the answer to this.
Best, Jared _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-leave@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/3W43OK... Code of Conduct: http://python.org/psf/codeofconduct/
participants (3)
-
Eric Fahlgren
-
Jared Crawford
-
Jelle Zijlstra