Would it be better if object.__hash__() raised a NotImplementedError?
It can't -- it's type.__hash__(object).
If I understand Barry's suggestion correctly, he means to keep object.__hash__, but have it raise a specific, meaningful error instead of making a potentially incorrect assumption as it does now.
E.g. (not real code, since this would behave differently in Py 2.3.3)
class Works(object): pass class Breaks(object):
... def __cmp__(): return 0 # All instances are created equal!
work = Works() break = Breaks() hash(work)
Traceback (most recent call last): <Traceback info> NotImplementedError: Must explicitly define __hash__ for non-default comparisons
hash(work) is fine, since there is no __cmp__ or __eq__ override in Works, and hence object.__hash__ never gets called.
hash(break) raises the exception because of the existence of the (rather useless) __cmp__ function in the Breaks class.