Why Python is not both an interpreter and a compiler?

Mahan Marwat mahanmarwat at gmail.com
Mon Aug 31 04:35:58 EDT 2015


What I know about an interpreter and a compiler is: they both convert source code to machine code and the only difference is, an interpreter convert it, line by line while compiler convert the whole source file.
Now if we compile a C source file on C compiler, it will produce a small executable file. But if we compile (freeze) a Python source file on Python interpreter (using cx_freeze), it will produce a big executable file.
Now the thing is C compiler does not embed a C compiler inside our program, while the Python interpreter (cx_freeze, pytoexe) embed Python interpreter inside our program, what is the reason?
The question is, why cx_freeze etc... embed Python interpreter inside our programs, they are unable to produce machine code like C compiler do?
Cant we program a language, which is both interpreted and compiled? The core developer cant add the compiling functionality to Python?



More information about the Python-list mailing list