Dev.to
7/8/2026

4 Advanced Python Patterns I Learned Auditing the HTTPX Source Code
Original: Why You Should Stop Reading Tutorials
Short summary
The author audited the HTTPX Python library source code and identified four advanced patterns tutorials rarely cover: keyword-only arguments via bare asterisks, sentinel objects to distinguish omitted args from explicit None, using collections.abc.MutableMapping instead of subclassing dict, and enforcing mypy strict mode from day one. The core message is that reading production-grade library source teaches more than standard tutorials. Practical advice: pick a well-maintained library, formulate questions, and dig through the codebase.
- •Use bare * in function signatures to force keyword-only arguments for clarity
- •Use sentinel objects instead of None defaults to distinguish omitted from explicitly-set values
- •Subclass collections.abc.MutableMapping instead of dict for custom containers
- •Enable mypy strict mode from the start to catch type errors in library code
Generated with AI, which can make mistakes.
Is this a good recommendation for you?



