ruff/crates/ty_python_semantic/resources/mdtest/literal/collections/tuple.md
2025-05-03 19:49:15 +02:00

357 B

Tuples

Empty tuple

reveal_type(())  # revealed: tuple[()]

Heterogeneous tuple

reveal_type((1, "a"))  # revealed: tuple[Literal[1], Literal["a"]]

reveal_type((1, (2, 3)))  # revealed: tuple[Literal[1], tuple[Literal[2], Literal[3]]]

reveal_type(((1, "a"), 2))  # revealed: tuple[tuple[Literal[1], Literal["a"]], Literal[2]]