class Evil(int):

    def __hash__(self):
        return random.randint(0, 10000)
evil_vals = [Evil(n) for n in range(10)]
dict_with_evil_keys = dict((evil_val, None) for evil_val in evil_vals)
print(evil_vals[0] in dict_with_evil_keys)
print(evil_vals[0] in list(dict_with_evil_keys.keys()))
python 2.7 presence in a dictionary