1from cython cimport typeof 2 3cdef class A: 4 pass 5 6cdef class B(A): 7 pass 8 9cdef struct X: 10 double a 11 double complex b 12 13def simple(): 14 """ 15 >>> simple() 16 int 17 long 18 long long 19 int * 20 int ** 21 A 22 B 23 X 24 Python object 25 """ 26 cdef int i = 0 27 cdef long l = 0 28 cdef long long ll = 0 29 cdef int* iptr = &i 30 cdef int** iptrptr = &iptr 31 cdef A a = None 32 cdef B b = None 33 cdef X x = X(a=1, b=2) 34 print typeof(i) 35 print typeof(l) 36 print typeof(ll) 37 print typeof(iptr) 38 print typeof(iptrptr) 39 print typeof(a) 40 print typeof(b) 41 print typeof(x) 42 print typeof(None) 43 used = i, l, ll, <long>iptr, <long>iptrptr, a, b, x 44 45def expression(): 46 """ 47 >>> expression() 48 double 49 double complex 50 int 51 unsigned int 52 """ 53 cdef X x = X(a=1, b=2) 54 cdef X *xptr = &x 55 cdef short s = 0 56 cdef int i = 0 57 cdef unsigned int ui = 0 58 print typeof(x.a) 59 print typeof(xptr.b) 60 print typeof(s + i) 61 print typeof(i + ui) 62 used = x, <long>xptr, s, i, ui 63