The old answer was that types were not known in advance. However with Python 3.6, it's possible to give type hints. Given this, is there anything stopping Python being compiled natively?
Cython compiles any python code to C which is then complied normally. If you provide type hints cython will use that to produce more optimized C code.<p>That being said the speedup from compiling your untyped python code is minimal, generally in the 0-40% range. However by adding types to your code you can often get significant speedups.
Yes. Exactly the same as before: dynamic typing. Optional type hints don't change this.<p>And Python actually <i>is</i> compiled. Where do you think these pyc and pyo files come from?