There are three types when you define a function in cython, the general difference between these types are:
- def function is called from Python code with Python objects as arguments, returns a python object.
- cdef is used for Cython function that are intended to be pure ‘C’ function. All types must be declared and it is not visible to python code when import the module include this function
- cpdef functions combine both def and cdef features.
Here will give you a intuitive feeling to the performance if you write in different types.