Cython
A Python superset that compiles to C — add types to make hot loops run at C speed and call C libraries.
Advanced
def total(double[:] a):
cdef double s = 0
cdef Py_ssize_t i
for i in range(a.shape[0]):
s += a[i]
return s
Used inside SciPy, pandas and scikit-learn.
Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.
Discussion (0)
Sign in or join free to ask questions and discuss this topic.