ruivieira.dev/
  • Home
  • About
  • Blog
  • Projects
  • Visuals

Python typing

1Unions

For Python 3.10 onwards1 https://docs.python.org/3/library/typing.html#typing.Union, Unions can be specified with the character |. For instance:

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

7ebe133f