Since Python 3.13, we now have EnumDict
in the enum
module.
from enum import EnumDict
class Color(EnumDict):
RED = "RED"
GREEN = "GREEN"
BLUE = "BLUE"
This allows you to do exactly what you want, because this enum behaves like a Python dictionary.