1from cython cimport typeof 2 3def call2(): 4 """ 5 >>> call2() 6 """ 7 b(1,2) 8 9def call3(): 10 """ 11 >>> call3() 12 """ 13 b(1,2,3) 14 15def call4(): 16 """ 17 >>> call4() 18 """ 19 b(1,2,3,4) 20 21# the called function: 22 23cdef b(a, b, c=1, d=2): 24 pass 25 26 27cdef int foo(int a, int b=1, int c=1): 28 return a+b*c 29 30def test_foo(): 31 """ 32 >>> test_foo() 33 2 34 3 35 7 36 26 37 """ 38 print foo(1) 39 print foo(1, 2) 40 print foo(1, 2, 3) 41 print foo(1, foo(2, 3), foo(4)) 42 43cdef class A: 44 cpdef method(self): 45 """ 46 >>> A().method() 47 'A' 48 """ 49 return typeof(self) 50 51cdef class B(A): 52 cpdef method(self, int x = 0): 53 """ 54 >>> B().method() 55 ('B', 0) 56 >>> B().method(100) 57 ('B', 100) 58 """ 59 return typeof(self), x 60 61cdef class C(B): 62 cpdef method(self, int x = 10): 63 """ 64 >>> C().method() 65 ('C', 10) 66 >>> C().method(100) 67 ('C', 100) 68 """ 69 return typeof(self), x 70