What's the correct way to convert a string to a corresponding instance of an Enum subclass? Seems like getattr(YourEnumType, str) does the job, but I'm not sure if it's safe enough. As an example, suppose I have an enum like class BuildType(Enum): debug = 200 release = 400 Given the string 'debug', how can I get BuildType.debug as a result? Continue reading...