Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/yurlungur/cython-example

A little example of how Cython works.
https://github.com/yurlungur/cython-example

Last synced: 13 days ago
JSON representation

A little example of how Cython works.

Awesome Lists containing this project

README

        

CYTHON EXAMPLE
======================================================================

Author: Jonah Miller ([email protected])
Time-stamp: <2014-10-13 00:14:14 (jonah)>

Open the IPython notebook through a walkthrough of how to change raw
Python code to Cython code and to look at the speedup it gives.

Or open the *.pyx file to look at what a Cython file looks like.

To compile the Cython code, simply run:
python setup.py build_ext --inplace

The setup.py defines which files to compile. The files ending in .pyx
are Cython files.

Cython will generate two types of files: files ending in .c and files
and files ending in .o. The files ending in .c are c source code that
was generated based on the Python code. The files ending in .o are
compiled library files that Python can read. To use a file named
library.o, simply start Python and type:
import library