1# Copied from cdef_multiple_inheritance.pyx 2# but with __slots__ and without __dict__ 3 4cdef class CBase(object): 5 cdef int a 6 cdef c_method(self): 7 return "CBase" 8 cpdef cpdef_method(self): 9 return "CBase" 10 11class PyBase(object): 12 __slots__ = [] 13 def py_method(self): 14 return "PyBase" 15 16cdef class Both(CBase, PyBase): 17 """ 18 >>> b = Both() 19 >>> b.py_method() 20 'PyBase' 21 >>> b.cp_method() 22 'Both' 23 >>> b.call_c_method() 24 'Both' 25 26 >>> isinstance(b, CBase) 27 True 28 >>> isinstance(b, PyBase) 29 True 30 """ 31 cdef c_method(self): 32 return "Both" 33 cpdef cp_method(self): 34 return "Both" 35 def call_c_method(self): 36 return self.c_method() 37 38cdef class BothSub(Both): 39 """ 40 >>> b = BothSub() 41 >>> b.py_method() 42 'PyBase' 43 >>> b.cp_method() 44 'Both' 45 >>> b.call_c_method() 46 'Both' 47 """ 48 pass 49