I have a Sage class that inherits from SageObject. According to the Python documentation,
User-defined classes have
__cmp__()
and__hash__()
methods by default; with them, all objects compare unequal (except with themselves) andx.__hash__()
returnsid(x)
.
However, my class doesn't do this, despite the fact that it doesn't implement a __hash__
method of its own. Instead, it uses the hash value of its string representation (the one returned by its __str__
method). Is this part of the design of Sage classes, something different from normal Python classes? Is there a hierarchy of places that Sage might look in order to find an acceptable hash value?