#Python
157 posts

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
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
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
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?
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
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
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
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
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
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.
Python Automation #4: Web Scraping Part 2 — Dynamic Pages with Playwright
Handle JavaScript-rendered pages that return empty HTML to requests by driving a real browser with Playwright. From install and a first script to wait_for_selector, login automation, infinite scroll, and saving to CSV — all in one pass.

Routing, Pydantic models, and dependency injection
Splitting routes with APIRouter, defining input/output schemas with Pydantic v2, and factoring shared logic out with Depends.