Commit 1bb1afb2 authored by Stefan Behnel's avatar Stefan Behnel

little test for comparing loop code

parent 9185baa2
__doc__ = """
>>> x = 1
>>> for i in range(10):
... x = x + i
>>> x
46
>>> add_pyrange(10)
46
>>> add_py(10)
46
>>> add_c(10)
46
"""
def add_pyrange(max):
x = 1
for i in range(max):
x = x + i
return x
def add_py(max):
x = 1
for i from 0 <= i < max:
x = x + i
return x
def add_c(max):
cdef int x,i
x = 1
for i from 0 <= i < max:
x = x + i
return x
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment