Following this question, we know that two different dictionaries,
You can't change the hash-function - the dict will call
hash on the keys it's supposed to insert, and that's that.
However, you can wrap the keys to provide different
class MyHash(object): def __init__(self, v): self._v = v def __hash__(self): return hash(self._v) * -1 def __eq__(self, other): return self._v == other._v
If this actually helps anything with your original problem/question I doubt though, it seems rather a custom array/list-based data-structure might be the answer. Or not.