def add_sentence(self, element: Sentence) -> None: """Dodaje zdanie `element` do zbioru, o ile już w nim nie jest. Konkretniej dodaje wartość hash zdania.""" if not isinstance(element, Sentence): raise TypeError("History can only store sentences") if DEBUG: return super().add(tuple(element.getUnique())) else: return super().add(hash(element))
def __contains__(self, item: Sentence) -> bool: if DEBUG: return super().__contains__(tuple(item.getUnique())) return super().__contains__(hash(item))