lycka at carmen.se
Tue Oct 11 18:05:23 CEST 2005
Donn Cave wrote:
> Quoth "Fredrik Lundh" <fredrik at pythonware.com>:
> | Alex Stapleton wrote
> | > Except it is interpreted.
> | except that it isn't. Python source code is compiled to byte code, which
> | is then executed by a virtual machine. if the byte code for a module is up
> | to date, the Python runtime doesn't even look at the source code.
> Fair to say that byte code is interpreted? Seems to require an
> application we commonly call an interpreter.
It's fair to say that Python works just the same as Java in
this regard. The myth seems to be that Python is interpreted
in the same way as a unix shell script, while Java does some-
thing much better.
"""Both Java and the .NET languages are "semi-compiled" (or, looking at
the flip side of the coin, "semi-interpreted"). By this I mean that
source code is compiled into intermediate-level code and then run by a
combination interpreter/just-in-time compiler. With Java, the
intermediate language is called bytecode and the interpreter/compiler is
called a Java Virtual Machine (JVM). Source code in the .NET world is
compiled into the Microsoft Intermediate Language (MSIL) and is run on
the .NET Common Language Runtime (CLR) engine."""
"""I wanted to find out how semi-compiled languages compare to fully
interpreted languages like Python, Perl or PHP."""
The big difference between Java and Python in regards to this benchmark
is that Python uses dynamic typing, which means that code such as
"a = a + i" must be capable to handle any concievable value of a and i.
In a naive benchmark like this, dynamic typing is just a disadvantage.
In real software development, it's often a big advantage, mainly in
terms of programmer productivity and program size.
More information about the Python-list