Skip to main content
Tweeted twitter.com/#!/StackProgrammer/status/640760855068581888
Copy editing
Source Link
Ixrec
  • 27.7k
  • 15
  • 84
  • 87

Why does Python needsneed both a compiler and an interpreter?

I can understand the fact whythat Java needs both a compiler and an interpreter. It compiles source code to byte codebytecode and then a virtual machine (on windowsWindows, on linuxLinux, on androidAndroid, etc.) translates byte codethat bytecode to amachine code thatfor the current architecture can understand.

But why does Python needsneed both a compiler and an interpreter? Why not just using interpretation sinceSince Python is not platform independent., why not just use interpretation? As far as I know, you cannot execute a Python program (compiled to bytecode) on every machine, such as on windows,any Windows or on linuxLinux machine without modification. Or am I wrong?

Please help

Why Python needs both a compiler and an interpreter?

I can understand the fact why Java needs both a compiler and an interpreter. It compiles source code to byte code and then a virtual machine (on windows, on linux, on android etc) translates byte code to a code that the current architecture can understand.

But why Python needs both a compiler and an interpreter? Why not just using interpretation since Python is not platform independent. As far as I know, you cannot execute a Python program (compiled to bytecode) on every machine, such as on windows, or on linux without modification. Or am I wrong?

Please help

Why does Python need both a compiler and an interpreter?

I can understand the fact that Java needs both a compiler and an interpreter. It compiles source code to bytecode and then a virtual machine (on Windows, on Linux, on Android, etc.) translates that bytecode to machine code for the current architecture.

But why does Python need both a compiler and an interpreter? Since Python is not platform independent, why not just use interpretation? As far as I know, you cannot execute a Python program (compiled to bytecode) on any Windows or Linux machine without modification. Or am I wrong?

Source Link
aris
  • 119
  • 1
  • 3

Why Python needs both a compiler and an interpreter?

I can understand the fact why Java needs both a compiler and an interpreter. It compiles source code to byte code and then a virtual machine (on windows, on linux, on android etc) translates byte code to a code that the current architecture can understand.

But why Python needs both a compiler and an interpreter? Why not just using interpretation since Python is not platform independent. As far as I know, you cannot execute a Python program (compiled to bytecode) on every machine, such as on windows, or on linux without modification. Or am I wrong?

Please help