On Tue, 13 Apr 2021 at 18:43, Stéfane Fermigier
[ munch ]
Python is, historically, a dynamically typed language, and gradual typing (see https://en.wikipedia.org/wiki/Gradual_typing) has been progressively added to it in the last decade or so. This is a legitimate approach, both from an academic and industrial point of view, and similar (with some variants) to what has been done also for JavaScript, Ruby, PHP, Lua, Perl, Scheme, etc. over the same period.
I'm aware of the difference between untyped and dynamic typing, and want to emphasise that I *like* the dynamic typing in Python. My complaint is not with gradual typing, but the current way it is done. [ munch ]
No need to integrate in CPython, one can already provide runtime type checking using the current language, see e.g. https://pypi.org/project/typeguard/
The current runtime type checking approach is causing significant performance problems, hence PEP 563, PEP 649, and the current discussion on python-dev about how to reduce them. In the TypeScript approach, "typed Python" is a distinct programming language that is translated into dynamic Python, those problems go away because the type notation would not be valid Python code. In the integrated approach, type checking built in, there would still be overhead but it would be *useful* overhead doing the actual type checking. -- cheers, Hugh Fisher