ID EN
Built-in Types

union_object == other

Python 3.11

Union objects can be tested for equality with other union objects. Details:

Syntax

PYTHON
union_object == other

Examples

Example 1
PYTHON
(int | str) | float == int | str | float
Example 2
PYTHON
int | str | int == int | str
Example 3
PYTHON
int | str == str | int
Example 4
PYTHON
int | str == typing.Union[int, str]
Example 5
PYTHON
str | None == typing.Optional[str]

See Also

typing.Union