How to work on Python Virtual Machine and is it mandatory to work on Python Virtual Machine | Selenium Python Forum
A
Arvind C Posted on 26/08/2020

How to work on Python Virtual Machine and is it mandatory to work on Python Virtual Machine


J
Jaspreet Replied on 28/08/2020

Hey, 

Python is an object oriented programming language like Java. Python is called an interpreted language. 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. There are steps followed to do so : 

Responsive image

  • 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.


Related Posts