Python Inner Working

·

2 min read

Actually, When I started python 2 years ago, I left it. After learning for 2 months, where I learn about basics. I was an enthusiast and I only want to learn new things.

But at that time no one taught me about python inner working even though before reaching to "ChaiAurCode" python video I never know about python inner working lets me introduce you step by step, how it actually works.

How Python Works

python is a general-purpose programming language which we can use in our day-to-day life. Understanding the inner working helps us to interact which with it easily.

When we write a code like "chai.py" it doesn't contain any bytecode but when we use import function then it creates a __pycache__ where it creates file like chai.cpython_312.py let understand it briefly

  1. We create a file where we write some of code.

  2. now we save it as hello_chai.py it is our source code.

  3. interpreter where lots of thing are already going on let's understand it briefly.

  4. (1). it will compile the code. (2). now it will become byte code. (3). Now through Virtual Machine (PVM) the byte code will be interpreted line by line.

Point 4

My point four became kichadi so let's understand it in detail what happens is that there are terms like Bytecode, PVM

Bytecode - It is a type of code produce after compilation of python source file, it is different from machine code, machine code is capable of giving direct instruction to processor like Apple M1, Intel Chips but byte code is code which are generated after compilation of source code, and it is not understandable by computer. In order to run we need a virtual machine which is also called PVM (Python Virtual Machine).

PVM - It is a type of virtual machine specifically design to run python byte code. It read code line by line which makes slow, but it helps in debugging easily than any other language.

That's All from my side i hope you understand something from this if not then i am sorry from my side, I never written a blog in my life this is my first blog, I hope you will understand.

#ChaiAurCode