Python
Language-level notes: idioms, gotchas, and concepts worth remembering while writing Python day to day.
Articles
- Python Tips & Tricks — name mangling, scopes and closures, concurrency vs. parallelism, threading vs. multiprocessing.
- UV: Managing Python Environments and Projects — a fast, all-in-one replacement for pip, pyenv, virtualenv, and pip-tools.
- Metaprogramming & Dunder Methods — the data
model protocol,
__call__, descriptors,__init_subclass__, and when a metaclass actually earns its place. - Typing Generics & TypeVar —
TypeVar, generic classes (classic and PEP 695 syntax),ParamSpec,overload, and static checking with mypy/pyright. - Designing Concurrent Tasks with asyncio — the event loop
model,
TaskGroupvs.gather, cancellation, and the synchronization primitives. - Logging & Tracing in Python — the
loggingmodule done right,contextvarsfor async-safe request context, and distributed tracing basics.
Contributing
Found a Python quirk or pattern worth keeping? Add it here as its own file. See Contributing for the how-to.