Get Enum name from multiple values python
The easiest way is to use the aenum library1, which would look like this: from aenum import MultiValueEnum class DType(MultiValueEnum): float32 = “f”, 8 double64 = “d”, 9 and in use: >>> DType(“f”) <DType.float32: ‘f’> >>> DType(9) <DType.double64: ‘d’> As you can see, the first value listed is the canonical value, and shows up in … Read more