Hello World
Cython has an unusually involved hello world program because it interfaces with the Python C API and the distutils extension building facility. At least three files are required for a basic project:
- A
setup.pyfile to invoke thedistutilsbuild process that generates the extension module - A main python program to load the extension module
- Cython source file(s)
The following code listings demonstrate the build and launch process.
# hello.pyx def say_hello: print "Hello World!" # launch.py import hello hello.say_hello # setup.py from distutils.core import setup from distutils.extension import Extension from Cython.Distutils import build_ext ext_modules = )] setup( name = 'Hello world app', cmdclass = {'build_ext': build_ext}, ext_modules = ext_modules )These commands build and launch the program
$ python setup.py build_ext --inplace $ python launch.pyRead more about this topic: Cython
Famous quotes containing the word world:
“We used chamber-pots a good deal.... My mother ... loved to repeat: When did the queen reign over China? This whimsical and harmless scatological pun was my first introduction to the wonderful world of verbal transformations, and also a first perception that a joke need not be funny to give pleasure.”
—Angela Carter (19401992)
“Our Lord Jesus Christ, my brethren, is our hero, a hero all the world wants.”
—Gerard Manley Hopkins (18441889)