Python typing

Unions

For Python 3.10 onwards1, Unions can be specified with the character |. For instance:

Union[int, str, float] # before 3.10
int | str | float      # after 3.10

Footnotes

  1. https://docs.python.org/3/library/typing.html#typing.Union↩︎