If you use Cython only for speed (i.e. not for packaging C libraries), you can use pure Python mode , which allows you to define types either in a separate .pxd file (which exists next to your code in the .py file), either using decorators.
The advantage of this mode is that your code can be run (and debugged) under plain Python. Then you are left with a class (hopefully small) of errors that arise due to the static typing of Cython, and not your code. The disadvantages are: 1) running your code under plain Python will be slower; 2) the syntax is a little dirtier than the standard Cython syntax; 3) you cannot access external C code like this, which is one of the main use cases for Cython.
Otherwise, your best bet would be the traditional "multitude of print applications." print locals() can be useful here! However, this is not entirely satisfactory.
source share