Python

Modern Python Intermediate #2: typing in earnest — Generic, Protocol, TypedDict, Literal
4 min read

Modern Python Intermediate #2: typing in earnest — Generic, Protocol, TypedDict, Literal

The next step from basics type hints — Generic for parameterizing types, Protocol for precise duck typing, TypedDict for dict shapes, and Literal for narrow unions.

Modern Python Intermediate #1: dataclass and __slots__
4 min read

Modern Python Intermediate #1: dataclass and __slots__

Every option of @dataclass for short, safe data classes — frozen, kw_only, field() — and __slots__ for memory savings.

Modern Python Basics #7: Modules/packages and pyproject.toml
4 min read

Modern Python Basics #7: Modules/packages and pyproject.toml

The import system, the difference between modules and packages, __init__.py and __main__, and pyproject.toml for dependencies, tool config, and distribution — all in one place.

Modern Python Basics #6: Errors and exception handling
4 min read

Modern Python Basics #6: Errors and exception handling

The roles of try/except/else/finally, raise and user-defined exceptions, and the ExceptionGroup and except* introduced in 3.11.

Modern Python Basics #5: Functions — argument patterns
5 min read

Modern Python Basics #5: Functions — argument patterns

Defaults, *args/**kwargs, positional-only(/), keyword-only(*) — every tool for writing function signatures expressively.

Modern Python Basics #4: Collections and comprehensions
4 min read

Modern Python Basics #4: Collections and comprehensions

The role of list/tuple/dict/set, plus comprehensions and generator expressions for building new collections in a single line.

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.