Friday, February 22, 2008

How Python Runs Programs

Chapter 2


How Python Runs Programs


The Python interpreter runs all the code written in Python. The compilation process in Python is in two phases; when Python codes are written using any text editor available, it can be compiled through the Windows command line/prompt. The Python Interpreter then compile these source codes to byte codes, a low-level language in which the computer can understand, before execution. The Python Virtual Machine (PVM), which is the python runtime environment, then executes these byte codes for the program output.


Source Codes

Byte Codes

Python Virtual Machine (PVM)


Python runs programs immediately they are executed into byte codes, unlike other compiled languages like C and C++ which make room for a recompilation exercise before the execution. The code compilation/execution cycle in Python is therefore straight forward and the most dynamic. For it give room for easy and fast development.


Other Implementation Alternatives


The explanations above suites the Cpython implementation, that is the standard implementation of the Python language. It is the common and the official Python Implementation, which compiled languages like C and C++ deploy. However, other implementations of code execution in Python abound; there is the Jython (or Java Python), a Java specific version of python for the Java developers, who adopt it as a scripting language in applets and java servelets. There is equally the IronPython, which is Windows specific and is used for .NET and C# language developments. With the exception of Cpython above, all other implementations of the Python language seems to have a more specific compilation and execution procedures different from that of the Cpython.


Other execution models of the Python language are Just-in-time Compiler and Shedding C++ Translator. The chapter closed with a brief about "Frozen Binaries", the packaging scheme for all Python coded programs.

No comments:

Post a Comment