Skip to content

Commit

Permalink
Mention use of cast in enum type stub example (#1877)
Browse files Browse the repository at this point in the history
  • Loading branch information
hauntsaninja authored Oct 30, 2024
1 parent d19b1b2 commit a1d4d07
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions docs/spec/enums.rst
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,9 @@ statically in cases where dynamic values are used.
genus: str # Non-member attribute
species: str # Non-member attribute

CAT = ... # Member attribute
DOG = ... # Member attribute
CAT = 1 # Member attribute with known value and type
DOG = cast(int, ...) # Member attribute with unknown value and known type
BIRD = ... # Member attribute with unknown value and type

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

0 comments on commit a1d4d07

Please sign in to comment.