On Wed, Aug 26, 2020 at 9:02 AM Guido van Rossum 
Mypy includes an experimental compiler from typed Python to C that actually does what the OP is looking for.

https://github.com/python/mypy/tree/master/mypyc

There is also Cython, which is almost exactly what the OP is looking for. 

(I’m curious about how mypyc is different than Cython (other than syntax) and I’ve lost track, but I thought Cython was looking into using standard type hint notation.

But there’s a trick: type hints can be (and often are) duck typed. That is, they might specify a Sequence of Numbers, which doesn’t provide enough information to compile down to fully performant code. 

In fact, when type hinting was standardized, it was explicitly said that that was not the goal.

-CHB 




--
--Guido van Rossum (python.org/~guido)


_______________________________________________

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/3FS5C32FVB6YNN5TL5WTZETSCGLEHDTI/

Code of Conduct: http://python.org/psf/codeofconduct/

--
Christopher Barker, PhD

Python Language Consulting
  - Teaching
  - Scientific Software Development
  - Desktop GUI and Web Development
  - wxPython, numpy, scipy, Cython