Browse by Topic
Popular
Popular Posts
Latest
Latest Posts
Python Type Parameter Syntax
Learn about Python's modern type parameter syntax introduced in PEP 695, how it compares with the traditional TypeVar approach, and when to use each.
Python Generic Syntax: TypeVar, Generic, and PEP 695
Learn Python generic syntax: how TypeVar, Generic, and PEP 695 are used to write reusable, type-checked classes and functions.
Python TypeIs for Precise Type Narrowing
TypeIs gives Python predicate functions a way to narrow types in both branches of a condition. See practical examples and how it differs from TypeGuard.
Python Typeguard: Runtime Type Checking
python typeguard: Learn how to use Python Typeguard to enforce type hints at runtime, catch type errors early, and integrate it with pytest for robust testing.
Python Never Type: Functions That Never Return
Learn how to use Python's Never type to annotate functions that raise, exit, or loop forever, and how it improves static type checking.
Python Self Type for Method Return Annotations
Learn how to use Python's Self type to annotate methods that return the instance, with correct type inference in subclasses and fluent interfaces.
Python Overload Type Hints: Multiple Signatures
Use Python's typing.overload to declare multiple type signatures for one function and improve static type checking accuracy.
Python abs() Function: Syntax, Edge Cases, and Usage
Understand Python's abs() function: syntax, behavior with numeric types, custom objects, edge cases, and performance considerations.
Python iter(): How the Built-in Function Works
Explains Python's iter() built-in: how it creates iterators, the two-argument sentinel form, custom iterator classes, and common edge cases.
Python __post_init__: Customizing Dataclass Initialization
How __post_init__ works in Python dataclasses: validation, derived fields, InitVar, inheritance, frozen instances, and common pitfalls.