TypeError: unhashable type

Jeremy Hylton jeremy at beopen.com
Fri Jun 9 12:59:42 EDT 2000


It seems that "unhashable type" is a pretty obscure error message.  If
you understand hashes, types, and dictionary implementation, it's
fine.  If not, you're left scratch your head.

It would be helpful to produce an error message like:
"dictionary key must be hashable type, not <type>"

It's a tad tricky to implement because the error message is generated
in PyObject_Hash.  The error would need to be caught in
PyDict_SetItem, cleared, and a new one set.

Any opinions?

Jeremy



More information about the Python-list mailing list