File: README.Debian

package info (click to toggle)
cython 0.9.8-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 6,988 kB
  • ctags: 4,303
  • sloc: python: 16,048; ansic: 3,029; makefile: 71
file content (23 lines) | stat: -rw-r--r-- 570 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Cython
------

A simple example how to use it in Debian. Create a file t.pyx:

$ cat t.pyx
def msum(long N):
    cdef long s = 0, k
    for k in range(N):
        s += k + 1
    return s
$ cython --convert-range t.pyx
$ gcc -fPIC -O3 -I/usr/include/python2.5/ -c -o t.o t.c
$ gcc -shared t.o -o t.so
$ python
Python 2.5.2 (r252:60911, May 28 2008, 08:35:32) 
[GCC 4.2.4 (Debian 4.2.4-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import t
>>> dir(t)
['__builtins__', '__doc__', '__file__', '__name__', 'msum']
>>> t.msum(5)
15