Abstraction
abstraction
Community
Type Hints, mypy, and the Runtime Truth
Python type hints are documentation that a static checker reads. The runtime ignores them. Here is what hints do, what mypy adds, and the libraries that validate at runtime on purpose.
dataclasses, attrs, and pydantic: Pick One
Three libraries solve the data-container problem and they answer different questions. dataclasses for internal objects, attrs for power-user customisation, pydantic for validating external input.
Adapter and Facade: The Two Patterns I Actually Use
Two structural patterns that survive every codebase: Adapter (when you cannot change the other side) and Facade (when you cannot change yours). The shape of each, and the small tells that say which one fits.
Dependency Injection Without a Framework
DI is a pattern, not a framework. The plain-language version (pass things in instead of newing them inside) covers ninety percent of cases. The trade-off versus DI containers, and where each one breaks down.
