Using Python for programming algorithms

Diez B. Roggisch deets at nospam.web.de
Mon May 19 09:40:16 EDT 2008


Roel Schroeven wrote:

> Bruno Desthuilliers schreef:
>> 1/ being interpreted or compiled (for whatever definition of these
>> terms) is not a property of a language, but a property of an
>> implementation of a language.
>> 
>> 2/ actually, all known Python implementations compile to byte-code.
>> 
> 
> You keep saying that, and in theory you're right. But I'm still inclined
> to disagree with it, since the practical reality is different. Python is
> indeed compiled to byte code, but if you compare that byte code with
> assembly code you'll see that there's a whole world of difference
> between the two, largely because of the dynamical nature of Python. Fact
> is that Python was designed from the start to run on a virtual machine,
> not on the native hardware.
> 
> C OTOH was designed to be compiled to assembly code (or directly to
> machine code) and as a result there are no (or virtually) no
> implementations that interpret C or compile it to bytecode.
> 
> I love Python, but IMHO it's a bit silly to maintain that the fact that
> Python compiles to byte code instead of assembly code/machine code is
> purely a matter of implementation; on the contrary, I believe it's a
> result of its design. I also think that there's a large difference
> between byte code and machine code (in Python's case; I haven't looked
> at other languages), and that it's a bit silly to try to trivialize that
> difference.

I strongly disagree. See the Java which is compiled to bytecode
*explicitly*, jet the JVM-bytecode is closer to Python than to what C++ is
compiled to. But then, it's possible to have JIT-compilers that bring
machine code back into the picture.

And see python + psyco as JIT. 

And OTOH see Objective-C and it's runtime for an example of a
machine-code-compiled language that still has huge dynamic runtime parts. 

All these blur the image extremely and make Bruno's point: compilation is an
artifact, not some inherent property of a language.

Diez





More information about the Python-list mailing list