Is there a dedicated way to get the number of items in a python `Enum`?
Yes. Enum
s have several extra abilities that normal classes do not:
class Example(Enum): this = 1 that = 2 dupe = 1 those = 3print(len(Example)) # duplicates are not counted# 3print(list(Example))# [<Example.this: 1>, <Example.that: 2>, <Example.those: 3>]print(Example['this'])# Example.thisprint(Example['dupe'])# Example.thisprint(Example(1))# Example.this