O'Reilly logo

Learning Cython Programming by Philip Herron

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 3. Extending Applications

As mentioned in previous chapters, I want to show how you can extend existing systems with Cython. So let's get right to doing that. We have several different approaches and techniques to use. Cython was originally designed to make computation faster with Python as part of the SAGE project. Therefore, you can actually plainly convert some of your Python code to use C types on big computations for an increase in speed. We can also, as we have seen, mix C and Python code to leverage extensive high-level Python APIs with the low-level system from C.

Cython pure Python code

Let's view a mathematical application that is actually taken from the Cython documentation. I wrote this equivalent in pure Python so we can compare ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required