<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Akashrana on Medium]]></title>
        <description><![CDATA[Stories by Akashrana on Medium]]></description>
        <link>https://medium.com/@akashrana0153?source=rss-8998f3737aa5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*QIYVLMKD6bWIuuoF</url>
            <title>Stories by Akashrana on Medium</title>
            <link>https://medium.com/@akashrana0153?source=rss-8998f3737aa5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 20:00:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@akashrana0153/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How Python Works: From Your Code to Execution]]></title>
            <link>https://medium.com/@akashrana0153/how-python-works-from-your-code-to-execution-d40b90e5f16c?source=rss-8998f3737aa5------2</link>
            <guid isPermaLink="false">https://medium.com/p/d40b90e5f16c</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[how-python-works]]></category>
            <category><![CDATA[python-inner-working]]></category>
            <dc:creator><![CDATA[Akashrana]]></dc:creator>
            <pubDate>Fri, 26 Jun 2026 07:00:38 GMT</pubDate>
            <atom:updated>2026-06-26T07:00:38.089Z</atom:updated>
            <content:encoded><![CDATA[<p>Python is one of the most popular programming languages because of its simple syntax and powerful ecosystem. But when you run a Python file, what actually happens behind the scenes?</p><p>This article walks through how Python works — from writing code to execution inside the interpreter.</p><h3>Step 1: You Write Python Code</h3><p>Everything starts with a .py file.</p><p>Example:</p><pre>print(&quot;Hello, World!&quot;)</pre><p>This is called <strong>source code</strong> — human-readable instructions.</p><h3>Step 2: Python Compiles the Code into Bytecode</h3><p>When you run:</p><pre>python app.py</pre><p>Python does not execute your text file directly.</p><p>First, Python converts your code into <strong>bytecode</strong>. (bytecode is not machine language)</p><p>Bytecode is an intermediate representation that looks closer to machine execution but is still platform independent.</p><p>Example flow:</p><pre>app.py<br>   ↓<br>Compilation<br>   ↓<br>Bytecode (.pyc)</pre><p>Python may store this compiled version in:</p><pre>__pycache__/</pre><p>Example:</p><ul><li>App =&gt; Original source file name.</li><li>cpython =&gt; Interpreter implementation (CPython).</li><li>313 =&gt; Python version (3.13).</li></ul><pre>__pycache__/<br>app.cpython-313.pyc</pre><p>This speeds up future runs.</p><h3>Step 3: Python Virtual Machine (PVM) Executes Bytecode</h3><p>After generating bytecode, Python sends it to the <strong>Python Virtual Machine (PVM)</strong>.</p><p>The PVM is the engine that reads bytecode instructions and executes them.</p><p>Simplified flow:</p><pre>Bytecode<br>   ↓<br>Python Virtual Machine<br>   ↓<br>Actual Program Output</pre><p>For example:</p><pre>x = 10<br>print(x + 5)</pre><p>The PVM performs:</p><ol><li>Create variable x</li><li>Store value 10</li><li>Load x</li><li>Add 5</li><li>Print result</li></ol><p>Output: 15</p><h3>Step 4: Memory Management Happens Automatically</h3><p>Python automatically manages memory.</p><p>When you create objects:</p><pre>users = [&quot;Alex&quot;, &quot;Sam&quot;]</pre><p>Python:</p><ul><li>Allocates memory</li><li>Tracks references</li><li>Frees unused memory using <strong>Garbage Collection</strong></li></ul><p>Example:</p><pre>users = None</pre><p>If nothing references the list anymore, Python eventually removes it.</p><h3>Step 5: Modules and Imports Are Loaded</h3><p>When you write:</p><pre>import math</pre><p>Python:</p><ul><li>Searches for the module</li><li>Compiles it if needed</li><li>Stores cache in __pycache__</li><li>Loads it into memory</li></ul><p>Then you can use:</p><pre>math.sqrt(16)</pre><h3>Inside the Python Architecture</h3><pre>Your Python Code (.py)<br>          ↓<br>      Python Compiler<br>          ↓<br>     Bytecode (.pyc)<br>          ↓<br>Python Virtual Machine<br>          ↓<br> Memory + OS Resources<br>          ↓<br>       Program Output</pre><h3>Why Python Feels Slower Than C or C++</h3><p>Languages like C compile directly into machine code.</p><p>Python takes an extra step:</p><pre>Source → Bytecode → Interpreter → CPU</pre><p>That extra interpretation layer trades raw speed for:</p><ul><li>Faster development</li><li>Cleaner syntax</li><li>Cross-platform compatibility</li><li>Huge library ecosystem</li></ul><h3>Final Thoughts</h3><p>Python hides How Python Works: From Your Code to Execution</p><p>Python is one of the most popular programming languages because of its simple syntax and powerful ecosystem. But when you run a Python file, what actually happens behind the scenes?</p><p>This article walks through how Python works — from writing code to execution inside the interpreter.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d40b90e5f16c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>