Cython
A Guide for Python Programmers
Publisher: O'Reilly Media
Final Release Date: January 2015
Pages: 254

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.

  • Use Cython’s static typing to speed up Python code
  • Gain hands-on experience using Cython features to boost your numeric-heavy Python
  • Create new types with Cython—and see how fast object-oriented programming in Python can be
  • Effectively organize Cython code into separate modules and packages without sacrificing performance
  • Use Cython to give Pythonic interfaces to C and C++ libraries
  • Optimize code with Cython’s runtime and compile-time profiling tools
  • Use Cython’s prange function to parallelize loops transparently with OpenMP
Table of Contents
Product Details
About the Author
Colophon
Recommended for You
Customer Reviews

REVIEW SNAPSHOT®

by PowerReviews
oreillyCython
 
4.3

(based on 6 reviews)

Ratings Distribution

  • 5 Stars

     

    (3)

  • 4 Stars

     

    (2)

  • 3 Stars

     

    (1)

  • 2 Stars

     

    (0)

  • 1 Stars

     

    (0)

100%

of respondents would recommend this to a friend.

Pros

  • Concise (5)
  • Easy to understand (5)
  • Helpful examples (4)
  • Well-written (3)

Cons

No Cons

Best Uses

  • Intermediate (3)
  • Novice (3)
    • Reviewer Profile:
    • Developer (5)

Reviewed by 6 customers

Displaying reviews 1-6

Back to top

 
4.0

A nice quick introduction

By Francesco Pischedda

from Sassari, Italy

About Me Developer

Verified Buyer

Pros

  • Concise
  • Easy to understand
  • Helpful examples

Cons

    Best Uses

    • Novice

    Comments about oreilly Cython:

    I started with cython knowing nothing and after a couple of chatpers I was ready to complete my very first python extension wrapping a not so simple c library.

     
    5.0

    Exactly what I expected.

    By anonymous coward

    from Knoxville, TN

    About Me Developer, Educator

    Verified Buyer

    Pros

    • Concise
    • Easy to understand

    Cons

      Best Uses

        Comments about oreilly Cython:

        I am writing a code to interface an old c++ code with python (lammps-python). The book provided examples for the edge cases I encountered. It was also very easy to follow. I love Cython and I think this book is great!

         
        5.0

        Great Cython book for all level programmers

        By RoFeld

        from Marlton, NJ

        About Me Data Engineer, Developer, Programmer

        Verified Reviewer

        Pros

        • Accurate
        • Concise
        • Easy to understand
        • Helpful examples
        • Well-written

        Cons

          Best Uses

          • Expert
          • Intermediate
          • Novice
          • Student

          Comments about oreilly Cython:

          This is a great book for all levels programmers. By page 9 you will have clear understanding of benefits of using Cython, and when Cython should be used. This book is great. I'm still reading this book now, half way through, and I have a very enjoyable read. And most important I know where I should implement Cython in my future projects.

          (3 of 4 customers found this review helpful)

           
          3.0

          Needs more detail on initial compiler setup

          By sean

          from berlin

          Verified Reviewer

          Comments about oreilly Cython:

          I bought the book so I didn't have to search the internet for the right way to set up cython with Windows and Anaconda distribution - ie ensure a quick start. There is no practically no mention of this. In fact the book uses mingw compiler when the cython documentation advises against it (claiming microsoft is standard compiler for python libraries on windows). https://github.com/cython/cython/wiki/CythonExtensionsOnWindows.

          (1 of 1 customers found this review helpful)

           
          4.0

          Good guide on the topic

          By colin

          from london

          About Me Developer

          Pros

          • Concise
          • Easy to understand
          • Helpful examples
          • Well-written

          Cons

            Best Uses

            • Intermediate
            • Novice
            • Student

            Comments about oreilly Cython:

            There are 4 guides on the official website. Unfortunately all of them are quite old: The contents are overlapped and not well structured. Outdated info scatters everywhere.

            Finally here comes this book. It offers a clear and well organized introduction on Cython, so you don't have to crawl through the 4 guides on the website back and forth.

            It suits most people, from beginner to intermediate.

            The only drawback is that the book doesn't contain any advanced material, i.e. how internally Cython compiles the code, what code does it generate underneath at each scenario. Maybe the author doesn't want to cover these implementation details as the book is rather a guide than a in-depth reference.

            Sadly there isn't any tutorial covering such topic at all in the market.

            (14 of 15 customers found this review helpful)

             
            5.0

            Great way to get in to Cython!

            By Danny

            from San Diego, CA

            About Me Developer

            Verified Buyer

            Pros

            • Accurate
            • Concise
            • Easy to understand
            • Helpful examples
            • Well-written

            Cons

              Best Uses

              • Expert
              • Intermediate

              Comments about oreilly Cython:

              As I'm writing this, the book is still an early release, so I am still missing the last few chapters, but I have been looking forward to, and reading, each update as quickly as they come out.

              Python is a great language for math/science work, but as an interpreted language, it can be slow for some uses. Cython is a clever way to overcome this limitation without losing the benefits of Python. This book is a great guide to all aspects of Cython.

              You don't need to know any Cython when you start this book (I'd never seen it before), but it is NOT an introduction to Python. I would suggest this book for people who are fairly familiar with Python and want to push it beyond what it can do on its own, or who would like to interface Python with C/C++ code for various reasons.

              Beyond just an introduction, this book goes in to great depth on the various aspects of Cython and C/C++ interfacing using Cython. After reading and developing along with this book you should be able to do just about anything there is to do in Cython. I can't recommend it highly enough!

              Displaying reviews 1-6

              Back to top

               
              Buy 2 Get 1 Free Free Shipping Guarantee
              Buying Options
              Immediate Access - Go Digital what's this?
              Ebook:  $25.99
              Formats:  DAISY, ePub, Mobi, PDF
              Print & Ebook:  $32.99
              Print:  $29.99