Cython has moved to github.

cython-devel

view tests/run/addloop.pyx @ 1622:4f0327bdebc9

test for temp allocation bug in call
author Robert Bradshaw <robertwb@math.washington.edu>
date Sat Jan 17 01:25:34 2009 -0800 (3 years ago)
parents ffc4ddefcc44
children 82d312a9f1fc
line source
1 __doc__ = u"""
2 >>> x = 1
3 >>> for i in range(10):
4 ... x = x + i
5 >>> x
6 46
8 >>> add_pyrange(10)
9 46
10 >>> add_py(10)
11 46
12 >>> add_c(10)
13 46
14 """
16 def add_pyrange(max):
17 x = 1
18 for i in range(max):
19 x = x + i
20 return x
22 def add_py(max):
23 x = 1
24 for i from 0 <= i < max:
25 x = x + i
26 return x
28 def add_c(max):
29 cdef int x,i
30 x = 1
31 for i from 0 <= i < max:
32 x = x + i
33 return x