On Wed, Apr 14, 2021 at 9:47 AM Hugh Fisher <hugo.fis...@gmail.com> wrote:
>
> > From: Ned Batchelder <n...@nedbatchelder.com>
> [ munch ]
> > This is very similar to statically typed languages. They also have two
> > steps:
> >
> >   * There is the first step that checks the types but does not run the
> >     program. In C/C++, this is the compiler, in Python it is "mypy".
> >   * There is the second step that runs the program but does not check
> >     the types. In C/C++, this is running the executable, in Python it is
> >     "python".
> >
> > In Python, we can skip the first step, and perhaps that is the source of
> > your concern.  I doubt anyone that has adopted type hinting in Python
> > will forget to run mypy, especially in a CI environment like you consider.
>
> In the current Python implementation, we can't skip the first step.
> Type hints have a significant performance impact on the Python interpreter,
> hence PEP 649. If we used the TypeScript approach, the typing hints would
> be removed before execution by the Python interpreter.
>

You're advocating an approach that absolutely mandates running the
type checker, but then caches the results in an executable file (the
JS file built from the TS source). Python already has a caching system
- the .pyc files - so if you're importing the same file more than
once, the cost of parsing type annotations is pretty much equivalent
to the cost of doing it in TypeScript.

Let's not get caught up in unfair comparisons, and just focus on
making Python as good as it possibly can be.

ChrisA
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/HE6IAG3W6SYCBSXXXFV5MBGMZRSIBK7P/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to