blob: bf62450734c60db0ab6a00e4f124b7f4bc6ae9c4 (
plain)
1
2
3
4
5
6
7
8
9
|
class Fruit:
def __init__(self) -> None:
self.name = "apple"
def __eq__(self, other: object) -> bool:
return isinstance(other, Fruit) and other.name == self.name
def __hash__(self) -> int:
return hash(self.name)
|