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 (<jmcrawford45@gmail.com>) escribió:
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.

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 <jmcrawford45@gmail.com> wrote:

El mié, 16 mar 2022 a las 3:58, Jared Crawford (<jmcrawford45@gmail.com>) escribió:
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.

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 <jmcrawford45@gmail.com> wrote:
participants (3)
-
Eric Fahlgren
-
Jared Crawford
-
Jelle Zijlstra