Learning Cython Programming is a short book about Cython – a new programming language, which tries to bridge the gap between Python and C(++). I myself dedicated chapter 9 of NumPy Cookbook to Cython. Cython allows you to call Python libraries from C(++) and the other way around. A couple of examples of this are given in the book. However I think the most important use case for Cython is to speed up Python code. This is demonstrated by a number of recipes as well.
Obviously the author is a skilled developer and he tries to mention his pet open source project as much as possible. He seems to expect his readers to be comfortable with Python, C(++) and *nix like systems (a small group I bet). So this is definitely not a tutorial for beginners. It still beats the online Cython documentation, but the book is too short in my humble opinion. I think that twice as many pages are required to make this a complete tutorial. A couple of pointers for people who are not that familiar with low level systems programming wouldn’t have hurt either.
Ladies and gentlemen, here’s the best Cython book out there. Oh, and before I forget, this is the only book dedicated to the subject. Seriously, I liked the book. It belong to the cetegory of those books that you read twice: the first time, all at once, to get an overall idea; the second, slower, to taste every line.
The author clearly states you need to know your way through both Python and C and, mainly, through compiling, linking and make files. He’s definitely sincere there, since the book starts directly throwing at you some (easy) makefile for you to swallow. If you are not comfortable with gcc, function attributes and/or handmade makefiles, then this book is not for you. To give you a clear idea of what I mean, here are three lines of code:
If you have no idea what’s happening, then don’t waste time on this book.
Assuming that you either are comfortable with this syntax or you dare reading it anyway, I can tell you the book is short but with lots of amazing content. The examples are very interesting (be sure to download the source code) but not entirely explained (some of them aren’t practically explained at all). The author covers both Cython ways: creating a shared object of native C code and use it in Python and embedding Python into a C binary.
The book has only 5 chapters but they are very intense and will prove your knowledge of C, GCC and GDB. Both linking models (Python to C and vice versa) are presented with both schemas and examples. You definitely want to keep those schemas saved somewhere safe.
Enough with the praises. I must anyway let you know that the book comes with typos and misspelled names, which sometimes make compiling and linking fail. I also guess that the author should guide us through all examples. We are reading the book to learn, so please lead me through the most important parts of the code, eventually repeating the key concepts.
As usual, you can find more reviews on my personal blog: http://books.lostinmalloc.com. Feel free to pass by and share your thoughts!