Redowan's Reflections — Page 14

Recent writing

Longer articles, short notes, and things I'll probably need to look up again.

Browse the archive
Self type in Python

Use Python's Self type from PEP 673 to annotate methods returning class instances, eliminating complex forward references and TypeVars.

Why 'NoReturn' type exists in Python

Use Python's NoReturn type to annotate functions that never return normally, helping type checkers understand exception-raising and infinite loop code.

Amphibian decorators in Python

Build Python decorators that work seamlessly with both sync and async functions using inspect.iscoroutinefunction for maximum flexibility.

Search and navigate

Navigate