def addOperation(self, OperationType, NodeA, NodeB = None): # search for the Operation with the Same Properties i = 0 while i < len(self.Content): if (self.Content[i].OperationType == OperationType) and \ (self.Content[i].NodeA == NodeA) and \ (self.Content[i].NodeB == NodeB): # ... return i i += 1 NewElement = DAGElement(OperationType) NewElement.NodeA = NodeA NewElement.NodeB = NodeB self.Content.append(NewElement) return i