In [40]:
%reload_ext Cython

In [49]:
%%cython
import numpy as np
cimport numpy as np
import cython

cdef mycython(object[double, ndim=1] f):
    for i in f:
        print i
        s=np.sum(f)
    print s
    return s

In [50]:
x=np.array([1.0, 2.0])

In [51]:
%%timeit -n1

mycython(x)


1.0
2.0
3.0
1.0
2.0
3.0
1.0
2.0
3.0
The slowest run took 12.57 times longer than the fastest. This could mean that an intermediate result is being cached.
1 loop, best of 3: 118 µs per loop

In [43]:
type(x[0])


Out[43]:
numpy.float64

In [ ]: