Python Type Hints - typing.Union


Python tip:

Use Union from the typing module to allow any of the listed types.

from typing import Union


def sum_ab(a: Union[int, float], b: Union[int, float]) -> Union[int, float]:
    return a + b