#Python

147 posts

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.

Metaclasses — when do you really need them?
7 min read

Metaclasses — when do you really need them?

Covers classes that build classes. The identity of type, the division with __init_subclass__, cases that class decorators solve, and the narrow areas where you really need a metaclass.

Modules, packages, and pyproject.toml
8 min read

Modules, packages, and pyproject.toml

The import system, the difference between modules and packages, __init__.py and __main__, and pyproject.toml as the single home for dependencies, tool settings, and publishing.

Pattern matching in depth
8 min read

Pattern matching in depth

The next step from basics match-case — class patterns and __match_args__, sequence/mapping patterns, captures and guards, and the antipatterns to avoid.

Performance — cProfile, py-spy, memory profiling
9 min read

Performance — cProfile, py-spy, memory profiling

The toolbox for finding and fixing slow Python code — timeit, cProfile, py-spy, line_profiler, memray, and common optimization patterns.

Publishing a library with uv — pyproject.toml and shipping to PyPI
9 min read

Publishing a library with uv — pyproject.toml and shipping to PyPI

Pin down what pyproject.toml means in one pass, then publish your first library to PyPI with uv build · uv publish.

Pydantic v2 in depth — validation, serialization, custom validators
13 min read

Pydantic v2 in depth — validation, serialization, custom validators

A dedicated deep dive on Pydantic, the core of FastAPI. v2's performance and API changes, the right places to use model_validator/field_validator, serialization control, and JSON Schema generation.