- Use promo code PRIMEBOOKS18 to save $5.00 when you spend $20.00 or more on Books offered by Amazon.com. Enter code PRIMEBOOKS18 at checkout. Here's how (restrictions apply)
Enter your mobile number or email address below and we'll send you a link to download the free Kindle App. Then you can start reading Kindle books on your smartphone, tablet, or computer - no Kindle device required.
To get the free app, enter your mobile phone number.
Cython: A Guide for Python Programmers 1st Edition
Use the Amazon App to scan ISBNs and compare prices.
See the Best Books of 2018 So Far
Looking for something great to read? Browse our editors' picks for the best books of the year so far in fiction, nonfiction, mysteries, children's books, and much more.
Special offers and product promotions
About the Author
Kurt Smith has been using Python in scientific computing ever since his college days, looking for any opportunity to incorporate it into his computational physics classes. He has contributed to the Cython project as part of the 2009 Google Summer of Code, implementing the initial version of typed memoryviews and native cython arrays. He uses Cython extensively in his consulting work at Enthought, training hundreds of scientists, engineers, and researchers in Python, NumPy, Cython, and parallel and high-performance computing.
Top customer reviews
There was a problem filtering reviews right now. Please try again later.
Cython allows you to speed up Python code by translating it to C (or C++), and it also allows you to create wrappers for C code to be called in Python.
The book assumes you know Python and C somewhat well. It is a niche book for experienced users. The author took a bold step in assuming the reader will be up to speed, and I appreciated that.
Chapter three did a great job explaining how Python and C are fundamentally different languages, but also how they are complementary. Cython acts an interface between the two languages allowing you to pick and choose where you want C level performance, or where you want ease of use functionality of Python.
The writing is excellent and the author assumes you are familiar with modern software techniques.
I will leave it to the author to explain it best with the last sentence from the book: "With this one multifaceted tool [Cython] in hand, we can confidently bring Python's dynamism to C and C++, and bring the performance of C and C++ to Python".
I will caution those who start to read the book and notice the immediate introduction of compiling Cython code (Chapter 2) even before going in-depth into syntax. Don't be discouraged, as this is actually a very clever organization by the author, whose comprehensible writing proves his knowledgeability in every topic here. Smith is starting off readers with a more conceptual, macroscopic look into how Cython code is ran - in multiple ways, as he explains in the chapter - so that way they're not constantly asking themselves that same question in the later chapters.
Which is to say, this book is meant to be read chronologically, and is not intended to be just a reference source on the subject. For that, you'll want to go to docs.cython.org or github.com/cython/cython/wiki. At roughly 220 pages of content, this book is incredibly dense for what it covers. It's definitely amazing how lean it is without being too overwhelming. Some key topics Smith covers includes organizing Cython code (Chapter 6), making a C library accessible to Python (Chapter 7), doing the same with C++ (Chapter 8), and using cProfile (Chapter 9). The entire text certainly comes off as a project that took years to pile all together.
As someone who's gone through the book page for page, I can assure others that there's at least something that even existing users of Cython are bound to learn. With that all said, my only gripe about Cython by Kurt Smith is what he doesn't cover: debugging and testing. I can understand the omissions for the reason of keeping it all concise, but it would've still been worthwhile to mention that Cython comes with a GDB extension called cygdb for when your project acts up. Still, these are ultimately minor complaints for what is easily the best learning resource on taking full advantage of Cython. Kudos to the computational plasma physicist himself, Kurt W. Smith.
Some other helpful notes:
-You should wait to install Cython before reading this book; Smith has helpful info on installing it for Linux, Mac OS X, and Windows in Chapter 2.
-Some topics make use of IPython and using Python decorators, so get acquainted with both.
-Know what pointers are!
-Be mindful of using C++ with Cython when reading Chapter 9, as the pairing of the two is (as of this writing) still a work in progress, something that even the author acknowledges at the end of the chapter. This is worth mentioning because, to my knowledge, it's hard to know for sure that all of the newer features of C++11 and C++14 are stable with Cython.
-There's a 4-part YouTube tutorial called "Cython: Speed up Python and NumPy, Pythonize C, C++, and Fortran, SciPy2013 Tutorial", presented by Kurt W. Smith himself, and it covers a lot of the same material in the book. It's specifically located in the Enthought YouTube Channel (if you have trouble finding it, its logo looks just like the icon used for the Nintendo Gamecube). [UPDATE 9-10-15: It's come to my attention that Smith has another tutorial in the same channel but much newer; look up "Cython: Blend the Best of Python and C++ | SciPy 2015 Tutorial | Kurt Smith". As a heads up, the tutorial is 3 hours and 45 minutes long.]
-https://github.com/cythonbook/examples is where all of the code examples from this book is stored. As a helpful gesture, Smith cites this URL as a footnote within the text from time to time.
Most recent customer reviews
It is so worthwhile to read thoroughly. I love it because there is no awesome cython tutorial on the internet.Read more