TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: Why can't Python be compiled?

3 pointsby Kepler-295calmost 8 years ago
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?

2 comments

dagwalmost 8 years ago
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.
dozziealmost 8 years ago
Yes. Exactly the same as before: dynamic typing. Optional type hints don&#x27;t change this.<p>And Python actually <i>is</i> compiled. Where do you think these pyc and pyo files come from?