def __eq__(self, other): """ Determine if two NamedState objects are equal via the ``==`` operator. """ if not hasattr(other, "_is_NamedState"): raise TypeError("Can only compare two NamedState objects") if State.__eq__(self, other) and self._p == other._p: return True else: return False
def __eq__(self, other: Any) -> bool: """ return whether self is equal to other. >>> is_p1_turn = True >>> s1 = SubtractSquareState(is_p1_turn, 20) >>> s2 = SubtractSquareState(is_p1_turn, 30) >>> s1 == s2 False >>> a1 = 7 >>> a2 = 'few' >>> a1 == s1 False >>> a2 == s2 False >>> s3 = SubtractSquareState(is_p1_turn, 20) >>> s1 == s3 True """ return (State.__eq__(self, other) and self.starting_number == other.starting_number)
def __eq__(self, other: Any) -> bool: """ return whether self is equivalent to other >>> is_p1_turn = True >>> c1 = ChopstickState(is_p1_turn) >>> c2 = ChopstickState(False) >>> c3 = 3 >>> c4 = 'Any' >>> c5 = ChopstickState(True) >>> c1 == c2 False >>> c1 == c3 False >>> c1 == c4 False >>> c1 == c5 True """ return (State.__eq__(self, other) and self.current_list == other.current_list)