0

Why Python uses interpreter instead of the compiler?

Is the interpreter necessary?!

21st Oct 2016, 12:56 PM
Sattar Hashemi khosroshahi
Sattar Hashemi khosroshahi - avatar
2 Answers
+ 2
That's because it's a script language. The code that you typed has to be translated into machine code in a way or another. With script languages like python and javascript, the source code is translated on the fly by an interpreter. With compiled languages like C/C++/C#, it is translated by a compiler, and the resulting binary file is what you launch. Compiled programs run faster than scripts since they don't need to be interpreted, but they are less flexible: you have to recompile after each modification of the source code before running the program again, and the compiled program will only work on the architecture it was compiled for. Java uses an hybrid solution: the source code is compiled to an intermediary byte code that when launched is interpreted by a Java Virtual Machine. As a result, it is faster than script languages, and still multiplatform.
21st Oct 2016, 2:15 PM
Zen
Zen - avatar
0
Technically, python has a compiler
30th Oct 2016, 4:58 PM
Joshua Christian
Joshua Christian - avatar