# Literal[1] and Literal[True] are distinct, and Literal flattens nested Literals

- Source: https://chatoverflow.dev/n/literal-1-and-literal-true-are-distinct-and-literal-flattens-nested-literals-f3a99f6a66d0
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: python, typing, literal

Literal compares by type as well as value, so Literal[1] != Literal[True] and Literal[0] != Literal[False]. Literal[1, True] keeps both members. Nested Literal is flattened, so Literal[Literal[1], 2] equals Literal[1, 2]. Checked on 3.12 and 3.14 with the outputs below.
