What I Learnt Today #1 – Python Auto-Suggest & Compilation


After a long break from coding due to exams and personal challenges, I’ve decided to restart my journey as a developer. And I’m beginning again with Python. Why Python? Because I’m already familiar with its rich ecosystem of libraries and its wide range of applications — especially in the areas I want to explore further: web development and machine learning.
My Python Learning Journey
I first learned Python a while back through Angela Yu’s 100 Days of Code Bootcamp on Udemy. That course was awesome — it really helped me build a solid foundation and get hands-on with Python’s vast and rich libraries.
Now that I’m restarting my journey, I wanted to revise my basics. For that, I turned to Hitesh Choudhary’s videos on the Chai aur Code YouTube channel. His way of explaining concepts is simple and practical, which makes it easier to get back into the flow.
👉 [Link to the video:- https://youtu.be/v9bOWjwdTlg?si=qRRMReEi_mjgxQru]
The Issue I Faced
When I started getting back to coding, I quickly realized that something was off — my Python code wasn’t being recognized properly in VS Code. The editor wasn’t suggesting libraries, functions, or methods that I had used before.
At first, it was frustrating. But while trying to fix this issue, I ended up learning a lot of new things about VS Code, Python extensions, and how the environment actually works — things I honestly didn’t know before.
When I faced this issue, my first instinct was to ask GPT for help. It suggested that I check whether the Pylance extension was installed in VS Code.
That’s when I realized something important — the last time I worked with Python, I wasn’t really familiar with Pylance.
I learned that Pylance is the language server for Python in VS Code, and it’s what powers features like IntelliSense, auto-suggestions, and type checking.
🔹 What is a Language Server?
A language server is a tool that provides “smart” language features (like IntelliSense, auto-completion, go-to-definition, and error checking) to your editor.
Instead of every editor (VS Code, Vim, Sublime, etc.) having to implement these features separately, they follow a standard called the Language Server Protocol (LSP).
The editor (VS Code in your case) talks to the language server in the background to provide suggestions, diagnostics, and other coding help.
🔹 Arpit! But, What is intellisense??
IntelliSense is basically the smart code completion feature in editors like VS Code.
Definition: IntelliSense is a set of features that make coding faster and easier by providing:
Auto-suggestions / code completion (functions, variables, methods).
Quick info / tooltips (hover over a function to see its documentation).
Parameter hints (when typing a function, it shows expected arguments).
Error checking / diagnostics (highlights mistakes as you type).
In VS Code, IntelliSense for Python is powered by the Pylance extension (which is built on top of Microsoft’s Pyright type checker). Without Pylance (or the Python extension), VS Code won’t know enough about Python libraries to give you good suggestions.
But you know what? It did not work out. Pylance was already installed and I even made sure the Python interpreter was correctly set. I even revised the settings.json file as per GPT’s instructions, but IntelliSense still refused to cooperate.
Finally, I ended up switching to the PyCharm environment — interestingly, that’s where I had first learned Python. It felt a bit like coming full circle, and now, things started working smoothly right away.
How Python Code is Compiled and Run Behind the Scenes
During the lecture, I also learned what actually happens behind the scenes when Python code is interpreted.
When you run a Python program, the Python interpreter (most commonly CPython) does two main jobs:
Compilation – The interpreter first compiles your source code (.py) into bytecode (a lower-level, platform-independent representation). These bytecode files are often saved as .pyc inside the __pycache__ folder. So that the next time we run the same script, Python can reuse the cached bytecode instead of recompiling from scratch.
Note:- Bytecode doesn't mean machine code
Execution – The compiled bytecode is then sent to the Python Virtual Machine (PVM), which executes it line by line.
What is CPython?
CPython is the default and most widely used implementation of Python.
Python itself is just a language specification (like rules of grammar in English).
But for the code to run, we need a program that understands Python code and executes it.
CPython is that program — it’s written in C language and it includes both a compiler + interpreter.
What is Bytecode?
Bytecode is an intermediate representation of your Python code. It’s not machine code (that’s why Python is slower compared to compiled languages like C++). Bytecode is platform-independent (same everywhere), but there's a catch. Bytecode is portable across machines, but only as long as each machine has a compatible Python interpreter.
When Does Python Bytecode Become Machine Code?
When Bytecode is sent to the PVM for execution, the PVM runs each instruction step by step. For every small operation—like loading a constant, adding a number, or performing an assignment—it calls underlying C functions. These C functions have already been compiled into machine code, which is what actually runs on the hardware.
Today was indeed mix of frustration and new learnings. Well, maybe these details aren’t something I’ll need every day, but learning about them today was still really interesting. It gives me a kind of energy and motivation to understand exactly what’s happening behind the scenes. There’s so much to learn in this vast field of programming that even one lifetime wouldn’t be enough, and that’s what makes it fulfilling.
Subscribe to my newsletter
Read articles from ARPIT NEGI directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

ARPIT NEGI
ARPIT NEGI
Hi, I’m Arpit 👋 On Hashnode, I’m documenting my journey as a developer — sharing what I learn every day, especially through my series 'What I Have Learnt Today'.