def __init__(self, attributes): try: color = Color(attributes["color"]) except: raise Errors.ColorError() else: self.color = color
def __init__(self, color): self.color = color if self.color == "Red": self.id = 0 if self.color == "Orange": self.id = 1 if self.color == "Yellow": self.id = 2 if self.color == "Green": self.id = 3 if self.color == "Cyan": self.id = 4 if self.color == "Blue": self.id = 5 if self.color == "Violette": self.id = 6 try: range(7).index(self.id) except: raise Errors.ColorError()