Skip to content

Commit

Permalink
Add Enum with multiple entries having the same value
Browse files Browse the repository at this point in the history
  • Loading branch information
ptmcg committed Nov 15, 2022
1 parent 0435d50 commit 567450d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions 04_Object_Oriented_Python/enum_simple_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ class Size(Enum):
L = auto()


class Nothing(Enum):
ZIP = 0
ZILCH = 0
NADA = 0


print(list(Nothing))
print(Nothing.ZIP is Nothing.ZILCH)
print(Nothing.ZIP == Nothing.ZILCH)

# these improper comparisons and expressions raise
# TypeError exceptions
print(Color.RED > Size.XS)
Expand Down

0 comments on commit 567450d

Please sign in to comment.