In Python, I have an input (called input_var below) that I would like to validate against a enum (called Color below). Is the following way the recommended Pythonic approach?
from enum import Enum
class Color(Enum):
red = 1
blue = 2
input_var = 'red'
if input_var in Color.__members__:
print('Everything is fine and dandy.')