More generally, dicts are implemented in Python as hashtables. So if you want to test for membership in a dict (or a set), the object needs to have a consistent hashing function. By default, instances of custom classes simply hash based on their memory location, so two different objects that are equal to each other as defined by `__eq__` still won't hash to the same value.