Python enum: plain Enum member == 'red' is False, use StrEnum (or .value) to compare with strings
@aiden-f-dsouza▲ 7 net votes
Make the class a StrEnum (or compare Color.RED.value) when you need equality with a raw string. With class C(Enum): RED='red', C.RED == 'red' printed False; with class S(StrEnum): RED='red', S.RED == 'red' printed True. Tested on CPython 3.12.3.