FastAPI Day 1: FastAPI Exists Because WSGI Couldn’t Scale Modern APIs
FastAPI Exists Because WSGI Couldn’t Scale Modern APIs You think FastAPI became popular because it is “fast.” That is not the real reason. FastAPI exists because the old Python web architecture was reaching its limits. To understand FastAPI, you first need to understand the problem it was trying to solve. Before FastAPI: The WSGI World For years, Python web applications were built using: Flask Django Pyramid Most of them relied on something called: ...

Design Patterns Day 2: Stop Hardcoding Object Creation: Factory Pattern for Real Systems
Stop Hardcoding Object Creation: Factory Pattern for Real Systems In Part 1, we used Strategy to remove if-else from business logic. Now we fix the next problem: who decides which strategy to create—and how? The Problem (Picking Up From Strategy) After introducing Strategy, you often end up here: def get_strategy(method: str) -> PaymentStrategy: if method == "credit_card": return CreditCardPayment() elif method == "paypal": return PayPalPayment() elif method == "upi": return UPIPayment() else: raise ValueError("Unsupported payment method") We removed conditionals from business logic… but moved them into selection/creation. ...

Design Patterns Day 1: Stop Writing Endless if-else: Strategy Pattern for Real Systems
Stop Writing Endless if-else: Strategy Pattern for Real Systems You start simple. A small feature. A couple of conditions. Then it grows. And suddenly, your code looks like this: def process_payment(method, amount): if method == "credit_card": return f"Processing {amount} via Credit Card" elif method == "paypal": return f"Processing {amount} via PayPal" elif method == "upi": return f"Processing {amount} via UPI" elif method == "crypto": return f"Processing {amount} via Crypto" else: raise ValueError("Unsupported payment method") Looks fine… until it doesn’t. The Problem At first glance, this works. ...
Python Day 10: Python Is Not Parallel — Concurrency, Threads & Async Explained
You think Python runs things in parallel. Most of the time, it doesn’t. Today, you understand how Python handles concurrency, why it behaves the way it does, and how async actually works. Today’s Goal By the end of today, you will: Understand concurrency vs parallelism Learn about threads and the GIL Understand async/await internals Know when to use threading vs async vs multiprocessing The Illusion import threading def task(): print("running") threading.Thread(target=task).start() You think: ...
Python Day 9: Your Functions Can Be Rewritten — Decorators & Runtime Behavior
You think a function is fixed once defined. It is not. In Python, functions are objects—and can be modified at runtime. Today, you understand how decorators actually work under the hood. Today’s Goal By the end of today, you will: Understand how decorators work internally Learn function wrapping Understand closures Use decorators for real-world patterns The Illusion def greet(): print("hello") You think: greet is just a function Reality: greet is an object that can be passed, modified, and replaced ...
Python Day 8: Stop Creating Lists — Iterators & Generators (Lazy Execution)
You think Python processes everything immediately. It doesn’t. Python can be lazy. Today, you understand how iteration really works under the hood. Today’s Goal By the end of today, you will: Understand iterator protocol Learn how generators work internally See how lazy execution saves memory Avoid unnecessary allocations The Illusion for i in [1,2,3]: print(i) You think: Python loops over the list directly Reality: Python asks for an iterator and pulls values one by one ...
Python Day 7: Errors Are Not Failures — Exception Handling & Control Flow
You think errors stop your program. In Python, they are part of control flow. Today, you understand how Python handles errors under the hood. Today’s Goal By the end of today, you will: Understand how exceptions work internally Learn stack unwinding Use exceptions correctly (and not overuse them) Understand performance implications The Illusion x = int("abc") You think: Program crashes Reality: Python raises an exception object and unwinds the stack What Is an Exception? An exception is: ...
Python Day 6: Imports Are Not Just Includes — Module System & Execution
You think import just brings code into your file. It does much more than that. Today, you understand how Python loads, initializes, and caches modules. Today’s Goal By the end of today, you will: Understand how Python resolves imports Learn module execution model Understand import caching Avoid common import pitfalls The Illusion import math You think: Python just loads math Reality: Python searches, loads, compiles (if needed), executes, and caches the module ...
Python Day 5: Your Function Calls Are Not Free — Call Stack & Execution Flow
You think calling a function is cheap. It isn’t. Every function call has a cost. Today, you understand what actually happens when Python executes functions. Today’s Goal By the end of today, you will: Understand how function calls work internally Learn what a call stack is Visualize execution flow Understand performance impact of function calls The Illusion def add(a, b): return a + b add(2, 3) You think: Python just jumps into the function Reality: ...
Python Day 4: Dictionaries Are Magic (Until They Aren’t) — Hashing & Collisions
You think dictionary lookup is always O(1). That’s only half the story. Today, you understand how dictionaries actually work. Today’s Goal By the end of today, you will: Understand how dictionaries store data Learn how hashing works Understand collisions and their impact Know when O(1) breaks down The Illusion user = { "name": "John", "age": 30 } You think: This is just key-value storage Reality: This is a highly optimized hash table Dictionary Internal Model key -> hash(key) -> index -> slot -> value Dictionary does NOT scan all keys. It jumps directly using hash. ...