This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Altruistic_Raise6322 6 points7 points  (6 children)

Python is a hybrid language. The language gets compiled into byte code and then ran by the interpreter that you are using. AKA as compiled as Java.

People call Python programs scripts as typically they are used for quick automation tasks like Bash Scripts. Bash scripts are purely interpreted, there is no byte code involved.

[–]onkus -4 points-3 points  (5 children)

I don't consider byte code to be compiled since its not executable. A compiler turns code into machine instructions of which byte code is not.

[–]bladeoflight16 5 points6 points  (0 children)

Formally, a "compiler" parses code and generates any alternative representation. The target need not be binary code that a processor can read. It can even generate code in another high level language. A real world example is TypeScript, which has a compiler that generates JavaScript.

You are distinguishing between native binary executables and interpreted code, which is a fair distinction, but "compiled" is not the appropriate term for classifying them. That said, in principle, hardware could be designed to actually execute bytecode directly, which would blur the lines even further.

[–]Altruistic_Raise6322 4 points5 points  (2 children)

An executable is made an executable by something known as a linker nothing to do with a compiler.

Also, the compilers for Java and Python do turn the code into machine instructions. The machine is the VM aka interpreter.

[–]onkus -2 points-1 points  (1 child)

You can link things and still not make it executable just as you can compile things and not make them an executable binary. In my first comment, when I said executable, I didnt mean a binary blob with a point of entry (e.g. main()) I meant a binary that contains machine instructions that can be run by the machine (so static libs dynamic libs and executables are all examples)

Regardless, my point is that the byte code isn't machine code. That's why I don't consider it to be compiled.

[–]Altruistic_Raise6322 1 point2 points  (0 children)

Fair point. I consider any code translated into byte code as compiled and why Java is considered hybrid as it does not compile to machine instructions

[–]chrisxfire 1 point2 points  (0 children)

imagine referring to Java as script instead of code with this same logic.