#Python

117 posts

Control flow — if, while, for, match-case
8 min read

Control flow — if, while, for, match-case

Flow control where blocks come from indentation, range/enumerate/zip, and match-case pattern matching that differs in feel from switch.

dataclass and __slots__
8 min read

dataclass and __slots__

Every option of @dataclass for short, safe data classes — frozen, kw_only, field() — plus __slots__ for memory savings, all in one place.

Decorator patterns
8 min read

Decorator patterns

Every shape of decorator that wraps a function — the basic form, decorators with arguments, functools.wraps, class decorators, and ParamSpec.

Descriptors and __set_name__
8 min read

Descriptors and __set_name__

How property works — the __get__/__set__ protocol and data/non-data descriptors, and clean validation fields with __set_name__.

Errors and exception handling
8 min read

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.

FastAPI setup and getting started
8 min read

FastAPI setup and getting started

Why FastAPI, first project setup with uv, Hello FastAPI, automatic OpenAPI/Swagger UI generation — all in one place.

Functions — argument patterns
9 min read

Functions — argument patterns

Every tool for writing function signatures expressively — defaults, *args/**kwargs, positional-only (/), and keyword-only (*).

Getting started and uv setup
7 min read

Getting started and uv setup

Build your first project with modern Python and uv, with type hints and the latest Python workflow from the start.

GIL and concurrency — threading vs multiprocessing vs asyncio
8 min read

GIL and concurrency — threading vs multiprocessing vs asyncio

The identity of the GIL, the division between threading/multiprocessing/asyncio, and the free-threaded builds of Python 3.13~3.14 (PEP 703/779) — all in one place.

Iterables, generators, yield from
9 min read

Iterables, generators, yield from

How for actually works. The iterable protocol, generator functions and expressions, delegation with yield from, and send/throw — all in one place.

Logging and observability
9 min read

Logging and observability

Pitfalls of the standard logging module, structured logging with structlog, distributed tracing with OpenTelemetry, and error tracking with Sentry.

Magic methods in depth and protocols
8 min read

Magic methods in depth and protocols

Every hook where Python objects integrate with language features. __call__, __getitem__, __hash__, __format__, __getattr__ — gathered in one place.