In Python 3, dict.keys() and dict.values() return special iterable classes – respectively a collections.abc.KeysView and a collections.abc.ValuesView. The first one inherit it’s __eq__ method from set, the second uses the default object.__eq__ which tests on object identity.