Is there a way to index a dict using an enum?
e.g. I have the following Enum and dict:
class STATUS(Enum):
ACTIVE = "active"
d = { "active": 1 }
I'd like to add the appropriate logic to the class STATUS in order to get the following result:
d[STATUS.ACTIVE]
# returns 1
I understand that the type of STATUS.ACTIVE is not a string.. But is there a way around other than declaring the dict using STATUS.ACTIVE instead of "active"?
Also: looking for a solution other than adding a class property or .value