kj <no.em...@please.post> writes: > In <87hbgxlk67....@gmail.com> Arnaud Delobelle <arno...@gmail.com> writes: > >>A simple fix is to use hash(frozenset(self.items())) instead. > > Thanks for pointing out the hash bug. It was an oversight: I meant > to write > > def __hash__(self): > return hash(sorted(tuple(self.items())))
But sorted returns a list! so you need rather: hash(tuple(sorted(self.items()))) However, it still won't work because some keys may be incomparable. E.g., try with {1:'a', 1j:'b'} -- Arnaud -- http://mail.python.org/mailman/listinfo/python-list