Saturday, August 25, 2012

Cython: combined power of C and Python; call back and forth between Python and C/C++

By Vasudev Ram

Cython - (Cython on Wikipedia) is "a language that makes writing C extensions for the Python language as easy as Python itself. It is based on the well-known Pyrex, but supports more cutting edge functionality and optimizations."


[ Cython gives you the combined power of Python and C to let you:

- write Python code that calls back and forth from and to C or C++ code natively at any point.

- easily tune readable Python code into plain C performance by adding static type declarations.

- use combined source code level debugging to find bugs in your Python, Cython and C code.

- integrate natively with existing code and data in legacy, low-level or high-performance libraries and applications.


Excerpts from Wikipedia:


Cython is particularly popular among scientific users of Python,[11][16][17] where it has "the perfect audience" according to Python developer Guido van Rossum.[18] Of particular note:

The free software Sage computer algebra system depends on Cython, both for performance and to interface with other libraries.[19]
Significant parts of the scientific and numerical computing libraries SciPy and NumPy are written in Cython.[20][21]
Cython's domain is not limited to just numerical computing. For example, the lxml XML toolkit is written mostly in Cython, and Cython is used to provide Pythonic bindings for many C and C++ libraries ranging from the graphics library OpenGL[22] to the messaging library ZeroMQ.[23]


- Vasudev Ram - Dancing Bison Enterprises

No comments: