Comment by johndough
18 days ago
Not sure if this is what you are looking for, but here is Python compiled to WASM: https://pyodide.org/en/stable/
18 days ago
Not sure if this is what you are looking for, but here is Python compiled to WASM: https://pyodide.org/en/stable/
No it's not. It's an "interpreter": The whole interpreter binary (in wasm) as well as the Python source is transferred to the client to be executed.
Oh, so you are looking for a real compiler. I do not think that it is possible to compile Python, since the language is just too dynamic.
You'd have to compile every function for every possible combination of types, since the types of the function arguments can not be known at compile time without solving the halting problem. Even worse, new types could be created at runtime.
You can either type everything (like Cython, which arguably is not really Python anymore) or include a compiler to compile types that were not known at compile time, but that is just a JIT compiler with extra steps.
But Python compilers exist, nuitka being a more famous one: https://en.wikipedia.org/wiki/Nuitka
1 reply →