Search code examples
javapythonlate-bindingcompiled

Interpreted vs. Compiled vs. Late-Binding


Python is compiled into an intermediate bytecode(pyc) and then executed. So, there is a compilation followed by interpretation. However, long-time Python users say that Python is a "late-binding" language and that it should`nt be referred to as an interpreted language.

  1. How would Python be different from another interpreted language?

  2. Could you tell me what "late-binding" means, in the Python context?

Java is another language which first has source code compiled into bytecode and then interpreted into bytecode.

  1. Is Java an interpreted/compiled language?

  2. How is it different from Python in terms of compilation/execution?

  3. Java is said to not have, "late-binding". Does this have anything to do with Java programs being slighly faster than Python?

It'd be great if you could also give me links to places where people have already discussed this; i'd love to read more on this. Thank you.


Solution

  • Late binding is a very different concept to interpretation.

    Strictly speaking, an interpreted language is executed directly from source. It doesn't go through a byte-code compilation stage. The confusion arises because the python program is an interpreter, but it interprets the byte-code, so it is Python's byte-code language that you would describe as "interpreted". The Python language itself is a compiled language.

    Java bytecode, in contrast, is both interpreted and compiled, these days. It is compiled into native code by a JIT-compiler and then run directly on the hardware.

    Late binding is a property of the type system and is present in most languages to some degree, regardless of whether they are interpreted or compiled.