79810207

Date: 2025-11-05 14:37:17
Score: 0.5
Natty:
Report link

I would prefer to go with sth. like this:

try:
    from enum import StrEnum
    class StringEnum(StrEnum):
        pass
except ImportError:
    from enum import Enum
    class StringEnum(str, Enum):
        pass

class MyEnum(StringEnum):
    choice1 = "choice1"
    choice2 = "choice2"
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Nikolai Ehrhardt