TypeError when creating frozenset with no hash
andrew at acooke.org
Sat Mar 14 23:58:00 CET 2009
I was going to file a bug report for this, but then I wondered if it was
considered normal behaviour. Am I wrong in thinking there should be a
better error message?
>>> class NoHash:
... def __hash__(self):
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: an integer is required
I understand that there is a real problem here (in my code I had forgotten
the "return"); the issue is whether the stack trace should contain some
reference to __hash__ or similar. Perhaps that is impossible for
containers implemented in C?
More information about the Python-list