5.3.7 Special Methods

Certain special methods must be defined in every extension class in order to work. In particular, they do not derive from higher classes. This can be very confusing if you are not aware of it. For example, suppose you define two classes $ A$ and $ B$ as follows:
cdef class A:
   def __hash__(self):
      return 0

cdef class B(A):
   def __repr__(self):
      return "I am class B"
Then $ B$ will not inherit the __hash__ method from class $ A$ . If you want $ B$ to be hashable, you must define a hash method explicitly for $ B$ , e.g.,
cdef class B(A):
   def __hash__(self):
      return A.__hash__(B)
   def __repr__(self):
      return "I am class B"

I do not know exactly which special methods do not get inherited. Definitely __hash__ and __richcmp__ do not.

See About this document... for information on suggesting changes.