
April 18, 2021
4:44 a.m.
I wonder if it would be useful to let this syntax be used for overloads as well. The current overload syntax is quite verbose, but could perhaps look like this: type def a(arg: int) -> int: ... type def a(arg: str) -> str: ... type def a(arg: object) -> NoReturn: ... def a(arg: Union[int, str, object]) -> Union[int, str]: if not isinstance(arg, (int, str)): raise TypeError return arg