About 82 results
https://rednafi.com/python/uniform-error-response-in-drf/ · 20 Jan 2022
Standardize Django REST Framework error responses using custom exception handlers to match Microsoft's REST API guidelines format.
https://rednafi.com/python/difference-between-typevar-and-union/ · 19 Jan 2022
Understand when to use constrained TypeVar vs Union in Python type hints for consistent types across function parameters and return values.
https://rednafi.com/python/lru-cache-on-methods/ · 15 Jan 2022
Avoid memory leaks when caching instance methods with lru_cache by making cache containers local to instances instead of global.
https://rednafi.com/python/text-cropping-with-textwrap-shorten/ · 6 Jan 2022
Crop text to character limits without breaking words using Python's textwrap.shorten for clean truncation with customizable placeholders.
https://rednafi.com/python/attribute-delegation-in-composition/ · 28 Nov 2021
Implement automatic attribute delegation in Python composition using __getattr__ magic method for inheritance-like attribute access patterns.
https://rednafi.com/misc/do-not-add-extensions-to-bash-executables/ · 23 Nov 2021
Why executable scripts shouldn't have extensions. Learn GitHub's scripts-to-rule-them-all pattern for language-agnostic project automation.
https://rednafi.com/python/use-init-subclass-hook-to-validate-subclasses/ · 20 Nov 2021
Validate subclass schemas at definition time with Python's __init_subclass__ hook, a cleaner alternative to metaclasses for enforcing structure.
https://rednafi.com/python/tqdm-with-multiprocessing/ · 18 Nov 2021
Integrate tqdm progress bars with multiprocessing.imap_unordered for visual feedback on parallel task execution across worker processes.
https://rednafi.com/misc/use-command-v-over-which/ · 16 Nov 2021
Replace which with command -v for POSIX-compliant executable lookup. Learn why command -v is the portable alternative for finding program paths.
https://rednafi.com/misc/use-curly-braces-while-pasting-shell-commands/ · 8 Nov 2021
Prevent shell commands from executing immediately when pasting. Use curly braces to safely paste multi-line commands with hidden newline characters.