def comparator(cls, et, et_list): etype = et.get_type() if etype in et_list: # if the type being compared is in the orderList, return it's position return et_list.index(etype) # otherwise return a value greater than the last position of the orderList return len(et_list)+1
def get(self, etype): for et in self: if et.get_type() == etype: return et return None
def __getattr__(self, etype): for et in self: if et.get_type() == etype: return et raise EnumeratedTypeError("unable to find %s" % str(etype))