overload
Domain: Validation Typing
π― Motivation
overload lets you declare multiple type signatures for the same function so type checkers understand different call patterns. It improves autocomplete and type accuracy for functions with varying argument types.
π Concrete Example
You write @overload def parse(x: str) -> int: ... and @overload def parse(x: bytes) -> str: ..., then implement one real function. mypy knows the return type depends on the input type.
π Analogy
overload is like a restaurant menu listing the same βlunch specialβ with different sides depending on the day. The kitchen (implementation) is the same, but the menu (type) shows different options.