Internal working of Python
Python is an object oriented programming language like Java. Python is called an interpreted language. Python uses code modules that are interchangeable instead of a single long list of instructions that was standard for functional programming languages. The standard implementation of python is called “cpython”. It is the default and widely used implementation of the Python.
Python doesn’t convert its code into machine code, something that hardware can understand. It actually converts it into something called byte code. So within python, compilation happens, but it’s just not into a machine language. It is into byte code and this byte code can’t be understood by CPU. So we need actually an interpreter called the python virtual machine. The python virtual machine executes the byte codes.

The Python interpreter performs following tasks to execute a Python program :
- Step 1 : The interpreter reads a python code or instruction. Then it verifies that the instruction is well formatted, i.e. it checks the syntax of each line.If it encounters any error, it immediately halts the translation and shows an error message.
- Step 2 : If there is no error, i.e. if the python instruction or code is well formatted then the interpreter translates it into its equivalent form in intermediate language called “Byte code”.Thus, after successful execution of Python script or code, it is completely translated into Byte code.
- Step 3 : Byte code is sent to the Python Virtual Machine(PVM).Here again the byte code is executed on PVM.If an error occurs during this execution then the execution is halted with an error message.
References :
https://leanpub.com/insidethepythonvirtualmachine/read
http://highered.mheducation.com/sites/9387067572/information_center_view0/index.html
Recommended Posts:
- Internal working of Set in Python
- Internal working of list in Python
- marshal — Internal Python object serialization
- Working with zip files in Python
- Working with PDF files in Python
- Working with csv files in Python
- Working with Images in Python
- Working With JSON Data in Python
- Python | Working with PNG Images using Matplotlib
- Python | Working with buttons in Kivy
- Python | Working with Pandas and XlsxWriter | Set – 2
- Python | Working with Pandas and XlsxWriter | Set – 3
- Python | Working with Pandas and XlsxWriter | Set - 1
- Change current working directory with Python
- Python | Working with buttons in Kivy with .kv file
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


