Python

Modern Python Basics #3: Control flow — if, while, for, match-case
4 min read

Modern Python Basics #3: Control flow — if, while, for, match-case

Indentation-based blocks, range/enumerate/zip, and match-case pattern matching that has a different feel from switch.

Modern Python Basics #2: Variables, basic types, and type hints
4 min read

Modern Python Basics #2: Variables, basic types, and type hints

Python is a dynamic language, but modern Python writes types from the start. int/str/bool/None and built-in generics, the int | None shortcut, and mypy/pyright.

Modern Python Basics #1: Getting Started and uv Setup
6 min read

Modern Python Basics #1: Getting Started and uv Setup

Why Python again — what changed in 3.14 since the 2017 tutorial, and building a first project with uv that replaces pip + venv + pyenv all at once.

Python — OOP Part 6: Magic Methods
4 min read

Python — OOP Part 6: Magic Methods

Today we'll look at magic methods — things we use all the time but don't always have a clear concept of, and sometimes don't even realize we're using.

Python — OOP Part 5: Inheritance and Subclass
12 min read

Python — OOP Part 5: Inheritance and Subclass

In this lesson we cover class inheritance and subclasses.

Python — OOP Part 4: Class Method and Static Method
7 min read

Python — OOP Part 4: Class Method and Static Method

An instance method takes the instance (self) as its first argument and creates, modifies, or references data scoped to a single instance — like an instance variable. A class method takes the class (cls) as its first argument and creates, modifies, or references data shared across all instances — like a class variable.

Python — OOP Part 3: Class Variable
8 min read

Python — OOP Part 3: Class Variable

In the previous lesson we covered the concept of an object — defining a class, creating instances, and using instance methods and instance variables via self. In this lesson we'll look at class variables, a slightly different concept from instance variables.

Python — OOP Part 2: Class and Instance
4 min read

Python — OOP Part 2: Class and Instance

Class and instance — what objects really are in Python, how to define a class with __init__, and the role of `self` in instance methods.

Python — OOP Part 1: What Is Object-Oriented Programming, and Why Use It?
8 min read

Python — OOP Part 1: What Is Object-Oriented Programming, and Why Use It?

An introduction to Object-Oriented Programming (OOP) — what it is, when to use it, and how it cleans up duplicated data and behavior compared to dictionaries and lists.

Python Basics #20 — Modules and Packages Vol. 2
4 min read

Python Basics #20 — Modules and Packages Vol. 2

Continuing from the previous lesson on modules, this post covers packages: how to organize modules into folders, sub-packages, the role of __init__.py, and convenient imports for users.

Python Basics #20 — Modules and Packages Vol. 1
6 min read

Python Basics #20 — Modules and Packages Vol. 1

Modules and packages aren't hard. This lesson explains what modules are, why we use them, how Python resolves imports, and how to create and import your own modules.

Python Basics #19 — Errors and Exception Handling
7 min read

Python Basics #19 — Errors and Exception Handling

Handle errors gracefully with try/except/else/finally. Catch specific built-in exceptions, fall back to a base Exception, and understand why the order of except clauses matters.