How to define a class that can act as dictionary key?

Xavier Ho contact at xavierho.com
Tue Sep 15 14:02:00 CEST 2009


On Tue, Sep 15, 2009 at 9:47 PM, Lambda <stephenhsu9 at gmail.com> wrote:

> When I run it, it says "TypeError: unhashable instance"
>
> I believe you need to implement __hash__() for the class. Make sure your
class returns a unique identifier for a certain value.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090915/86957994/attachment.html>


More information about the Python-list mailing list