Christian Heimes <lists at cheimes.de> writes: > > def __hash__(self): return (self.term, self.doc_freq) > > > > is probably the easiest. > > The __hash__ function must return an integer: Oh oops. Try: def __hash__(self): return hash((self.term, self.doc_freq))