Python's Inner Working

As we all know python is a very popular programming language. The popularity of the language is increasing day-by-day also python has very great significance in the field of Artificial Intelligence or Data related work.

Python is also a very beginner friendly language, which can be learned and understood by anyone easily.

In this article we will see how python actually works in the background.

How Python actually works?

To learn and understand any programming language it is very important to understand how the language works behind the scene. It helps us understand the language properly and enhance our learning.

💡
Python is a Interpreted Language.

Interpreted language means, when a source code is written it is compiled to bytecode and directly pass on to the runtime environment for execution.

Here the python works as follows:

A. The python source code is compiled to Byte code.

B. Then the byte code is passed on to the python virtual machine for the execution.

Python Virtual machine

Python virtual machine provides a runtime environment for your python code to be executed.

Python virtual machine is also known as Python Interpreter.

Byte code in python

💡
Byte code is NOT machine code.

The Byte code file in python is mostly hidden but the format of the file is as below:

\> For file hello_world.py

💡
hello_world.cpython-311.pyc

Here,

hello_world: It is the file name

cpython : It is the standard implementation of the python. In most of the cases it is cpython. There are some other implementation like jython, IronPython, Stackless, etc.

311: It is the current version of python on your system.

.pyc: It is the extension for byte code file in python.

This is the entire process of how python works internally.

Here is a video in depth explanation for python's inner working:

Also connect with me on:

linkedin.com/in/aditya-kumbhar-688a17252

https://twitter.com/AdityaKumbhar_7