Lambda <stephenhsu9 at gmail.com> writes:
> When I run it, it says "TypeError: unhashable instance"
>
> It looks like I can't use the new class object as the dictionary key.
> What should I do?
You have to add a __hash__ method. Untested:
def __hash__(self): return (self.term, self.doc_freq)
is probably the easiest.