Checking for valid enum types from protobufs
问题 In my protobuf file called skill.proto, I have: message Cooking { enum VegeType { CAULIFLOWER = 0; CUCUMBER = 1; TOMATO = 2 } required VegeType type = 1; } In another file (eg: name.py) I want to check that the enum within the file is a valid type #if (myCookingStyle.type != skill_pb2.Cooking.VegeTypes): print "Error: invalid cooking type" How do I check that myCookingStyle.type is a valid enum type? ie: how do I do that commented line NB: I want to avoid doing hard coding of the checking for