PadhaiTime Logo
Padhai Time

Python Flow of Execution 

Let us understand a few terminologies before we check the Python flow of execution:



A piece of software. The process of converting high-level language code into machine language code (0s and 1s) is known as compiling a program. In a compiler, the source code is translated to object code successfully if it is free of errors. The compiler specifies the errors at the end of the compilation with line numbers when there are any errors in the source code. The errors must be removed before the compiler can successfully recompile the source code again.



The source code is read line by line by the interpreter and then converts it into object code. An interpreter is a language processor that converts a single statement from a source programme into machine code, executes it, and then moves on to the next line. If the statement contains a mistake, the interpreter stops translating at that point and outputs an error notice. Only once the error has been fixed the interpreter goes on to the next line for execution. 



Creating an executable programme by connecting the various software modules and libraries. A linker is a system software that assists in the linking of program object modules into a single object file. It carries out the connection procedure. Link editors are another term for linkers. Linking is the process of gathering and storing pieces of code and data in a single file. A specific module is also linked into the system library by the linker. It accepts assembler object modules as input and produces an executable file for the loader. Linking occurs at both compile and load time, when the source code is converted into machine code and the program is loaded into memory by the loader. Linking is the final step in compiling a programme.



Assign memory space in RAM to the running program. The loader is a specific program that accepts executable file input from the linker, loads it into main memory, and prepares it for computer execution. The Loader allocates memory space to the application. It also establishes symbolic relationships between items. It is responsible for loading applications and libraries into the operating system. Loaders are not present in embedded computer systems. Code is run in them through ROM.



Internal Working of Python:

Step 1: A Python source code or instruction is read by the Python compiler. Then it validates the syntax of each line to ensure that the instruction is properly formed. If a problem occurs, it instantly stops the translation and displays an error notice.


Step 2: If there are no errors, i.e. the python instruction or source code is properly formed, the compiler transforms it into its equivalent form in an intermediate language known as "Byte code."


Step 3: Byte code is then transferred to the Python Virtual Machine (PVM), which serves as the interpreter for Python. Python byte code is converted into machine-executable code via PVM. If an error occurs during this interpretation, the conversion is interrupted and an error notification is displayed.


Bengaluru, India
  • We collect cookies and may share with 3rd party vendors for analytics, advertising and to enhance your experience. You can read more about our cookie policy by clicking on the 'Learn More' Button. By Clicking 'Accept', you agree to use our cookie technology.
    Our Privacy policy can be found by clicking here