Skip to content

Commit 39dd3c5

Browse files
committed
reword more
1 parent e7cba09 commit 39dd3c5

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

docs/spec/literal.rst

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,18 +98,23 @@ expressions, and nothing else.
9898
Legal parameters for ``Literal`` at type check time
9999
"""""""""""""""""""""""""""""""""""""""""""""""""""
100100

101-
``Literal`` may be parameterized with literal ints, strings, `bytes` objects,
102-
bools, Enum values and ``None``. So for example, all of
101+
``Literal`` may be parameterized with literal ``int``, ``str``, ``bytes``,
102+
and ``bool`` objects, instances of ``enum.Enum`` subclasses, and ``None``. So for example, all of
103103
the following would be legal::
104104

105105
Literal[26]
106-
Literal[0x1A] # Exactly equivalent to Literal[26]
106+
Literal[0x1A] # Equivalent to Literal[26]
107107
Literal[-4]
108108
Literal["hello world"]
109-
Literal[u"hello world"] # Exactly equivalent to Literal["hello world"]
109+
Literal[u"hello world"] # Equivalent to Literal["hello world"]
110110
Literal[b"hello world"]
111111
Literal[True]
112-
Literal[Color.RED] # Assuming Color is some enum
112+
113+
class Color(enum.Enum):
114+
RED = 1
115+
GREEN = 2
116+
117+
Literal[Color.RED]
113118
Literal[None]
114119

115120
**Note:** Since the type ``None`` is inhabited by just a single

0 commit comments

Comments
 (0)