Skip to content

Commit a1d4d07

Browse files
authored
Mention use of cast in enum type stub example (#1877)
1 parent d19b1b2 commit a1d4d07

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

docs/spec/enums.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,9 @@ statically in cases where dynamic values are used.
123123
genus: str # Non-member attribute
124124
species: str # Non-member attribute
125125

126-
CAT = ... # Member attribute
127-
DOG = ... # Member attribute
126+
CAT = 1 # Member attribute with known value and type
127+
DOG = cast(int, ...) # Member attribute with unknown value and known type
128+
BIRD = ... # Member attribute with unknown value and type
128129

129130
* Members defined within an enum class should not include explicit type
130131
annotations. Type checkers should infer a literal type for all members.

0 commit comments

Comments
 (0)