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:
“The hotel was once where things coalesced, where you could meet both townspeople and travelers. Not so in a motel. No matter how you build it, the motel remains the haunt of the quick and dirty, where the only locals are Chamber of Commerce boys every fourth Thursday. Who ever heard the returning traveler exclaim over one of the great motels of the world he stayed in? Motels can be big, but never grand.”
—William Least Heat Moon [William Trogdon] (b. 1939)
“Cleopatra: Was I right to avenge myself?... Caesar: If one man in all the world can be found, now or forever, to know that you did wrong, that man will have either to conquer the world as I have, or be crucified by it.”
—George Bernard Shaw (18561950)