Summary
There are a lot of fundamentals of using Cython in this chapter. It's important to review what you want to achieve when using Cython, since the different ways in which it can be used affects how you design a solution. We investigated the differences between def
, cdef
, and cpdef
. We created public C/C++ declarations of types and callable functions. Using these public declarations, we showed how Python can callback into C code. For me, reusing any Python module within native code is very useful and interesting. I demonstrated how I use the Python logging
and ConfigParser
modules from C code. Appreciating these simple examples, we will see how we can extend C/C++ projects with Python code in the next chapter.