Chapter 4: C Performance with Cython

Cython is a language that extends Python by supporting the declaration of types for functions, variables, and classes. These typed declarations enable Cython to compile Python scripts to efficient C code. Cython can also act as a bridge between Python and C as it provides easy-to-use constructs to write interfaces to external C and C++ routines.

In this chapter, we will learn about the following topics:

  • Compiling Cython extensions
  • Adding static types
  • Sharing declarations
  • Working with arrays
  • Using a particle simulator in Cython
  • Profiling Cython
  • Using Cython with Jupyter

Through this chapter, we will learn how to leverage Cython to improve the efficiency of our programs. While a minimum knowledge of C is ...

Get Advanced Python Programming - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.