If I have a class like this:
class MyClass:
ONE = 1
TWO = 2
Is there a way to simplify the code below using reflection or some other Python feature?
def class_value_to_string(my_class_num):
if my_class_num == MyClass.ONE:
return "ONE"
elif my_class_num == MyClass.TWO:
return "TWO"
else:
return "UNKNOWN VALUE"