diff --git a/Chapter2/generic_search.py b/Chapter2/generic_search.py index 6e0ceb7..d5d0032 100644 --- a/Chapter2/generic_search.py +++ b/Chapter2/generic_search.py @@ -32,11 +32,11 @@ def linear_contains(iterable: Iterable[T], key: T) -> bool: class Comparable(Protocol): - def __eq__(self, other: Any) -> bool: - ... + def __eq__(self: C, other: C) -> bool: + return self == other def __lt__(self: C, other: C) -> bool: - ... + return (self < other) and self != other def __gt__(self: C, other: C) -> bool: return (not self < other) and self != other