As is the tradition with programming languages, we will start with a Hello World example. Unlike Python, we need to compile Cython code. We start with a
.pyx file, from which we will generate C code. This
.c file can be compiled and then imported into a Python program.
This section describes how to build a Cython Hello World program:
Hello World. This is just normal Python code, but the file has the
def say_hello(): print "Hello World!"
setup.pyto help build the Cython code:
from distutils.core import setup from distutils.extension import Extension from Cython.Distutils import build_ext ext_modules = [Extension("hello", ...