I have a Cython file called foo.pyx containing the following functions:
def add_one(int n): cdef int m = n + 1 return m cdef int c_add_one(int n): return n + 1
I create this pyx file using cython -a foo.pyx and can:
>>> import foo >>> foo.add_one(5) 6 >>> foo.c_add_one(5) AttributeError: 'module' object has no attribute 'c_add_one'
So it looks like I cannot call c_add_one from python. What are the benefits of declaring a function with cdef ?
source share