[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why Python is not both an interpreter and a compiler?

Ben Finney <ben+python at benfinney.id.au>:

> Yes, that's because the C language is low-level enough that a compiler
> can target directly the host CPU's machine code. A Python program,
> though, is written in a dynamic language, which is compiled to a
> virtual machine code, which needs the Python virtual machine as well
> to interpret that machine code.

More generally, both C and Python programs are run with the assistance
of a run-time environment. C programs are compiled in such a way that a
single compiled file is enough to start up the program. Python programs
*could* easily be compiled the same way, but it generally hasn't been
considered all that useful.