Jump to ratings and reviews
Rate this book

Cython: A Guide for Python Programmers

Rate this book
Build software that combines Pythonâ??s expressivity with the performance and control of C (and C++). Itâ??s possible with Cython, the compiler and hybrid programming language used by foundational packages such as NumPy, and prominent in projects including Pandas, h5py, and scikits-learn. In this practical guide, youâ??ll learn how to use Cython to improve Pythonâ??s performanceâ??up to 3000xâ?? and to wrap C and C++ libraries in Python with ease. Author Kurt Smith takes you through Cythonâ??s capabilities, with sample code and in-depth practice exercises. If youâ??re just starting with Cython, or want to go deeper, youâ??ll learn how this language is an essential part of any performance-oriented Python programmerâ??s arsenal.

254 pages, Paperback

First published December 25, 2014

37 people are currently reading
84 people want to read

About the author

Kurt W Smith

2 books1 follower

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
17 (34%)
4 stars
21 (42%)
3 stars
10 (20%)
2 stars
0 (0%)
1 star
1 (2%)
Displaying 1 - 5 of 5 reviews
Profile Image for Serdar.
Author 13 books34 followers
January 7, 2017
My browser just ate the entire original version of this review because I'm a klutz. But here's the short version.

- Python is slow. C is fast.
- Programming in Python is easy. Programming in C is hard.
- Cython bridges the gap. Write Python, convert it to C incrementally.
- This book does a great job of walking you through the process and teaching you how to get the most out of one of the best things to happen to Python since Guido van Rossum himself.
- It's aimed mainly at number-crunchers -- lots of focus on integration with Numpy -- but the motivated programmer can easily see how to apply it to many other fields. (In my case, I wrote a video game and got massive speedups by moving performance-crucial code to C with Cython, mainly the collision detection algorithms.)
- Not a long book, but that adds to its accessibility.
- Anyone remotely interested in enhancing Python performance where it's warranted* deserves to pick this up.

* Python's big appeal is that it swaps programmer convenience for raw performance. A script thrown together in ten minutes that takes two minutes to run will always beat a program that takes two days to put together but executes in a tenth of a second. But with Cython, we're reaching a point where we don't have to compromise.
Profile Image for Douglas Baldwin.
1 review
March 16, 2015
Kurt Smith's Cython is very clear. With only a few days of reading and coding, I was able to speed up my pure-Python simulation from 6 s per iteration to just 30 ms! If you're simulating physics in Python on a workstation, I highly recommend this book.
13 reviews1 follower
March 17, 2018
Really nice if you want to get familiar with lower-level implementation with Python, especially for scientific computing.
I enjoyed the sections on typed memoryviews and OpenMP (prange) + concrete examples with speedups measure.
113 reviews1 follower
May 10, 2023
Very dense. More reference than textbook. A couple of good worked examples.
Displaying 1 - 5 of 5 reviews

Can't find what you're looking for?

Get help and learn more about the design.