On Wed, Aug 26, 2020 at 8:41 AM Ronald Oussoren via Python-ideas <python-ideas@python.org> wrote:

On 26 Aug 2020, at 17:02, krishnans2006@gmail.com wrote:

One suggestion I had for the next Python release is to add type-implication support. Many developers have learned Python, but do not want to use it since it is slow. An awesome way to fix this is to have optional type-implications. For example, if you know for sure that variable x is an int, you can make Python just a bit smaller by somehow specifying to the interpreter that the variable is an integer. Something like 'x::int = 5'. By having optional type implications, you can still do everything you do with normal Python, except you can speed it up a little bit by telling the Interpreter that this variable is starting off with this datatype.

Python as type annotations, but those are primarily used for type checking using tools such as mypy and are not used by the interpreter itself. 

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

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