# [Numpy-discussion] Project for Cython integration with NumPy

Stéfan van der Walt stefan@sun.ac...
Tue Apr 1 01:39:10 CDT 2008

```Hi Dag

On Tue, Apr 1, 2008 at 12:52 AM, Dag Sverre Seljebotn
<dagss@student.matnat.uio.no> wrote:
> > I am going to apply for a Google Summer of Code project about "Developing
>  > Cython towards better NumPy integration" (Cython: http://cython.org).
>  > Anyone interested in how this is done can have a look at the links below,
>  > any feedback is welcome.
>  >
>
> > The application I am going to submit (to Python Foundation):
>  > http://wiki.cython.org/DagSverreSeljebotn/soc
>
>  I now have time to actively discuss and improve it so any feedback from
>  the NumPy community is greatly appreciated.

Sorry for only responding now; I was traveling back from Europe.

The project your propose has important implications for NumPy.
Currently, much of the core is implemented in C and very few people
have in-depth knowledge of its inner workings.  We therefore have
fewer eyes on that code than we'd like.  Furthermore, there are only
two ways of extending the core: 1) use Python callbacks, which are
slow or 2) learn the C API and deal with reference counting -- too
much to ask from a scientist who simply wishes to implement a fast
algorithm.

There are also some other projects, like scipy.ndimage, that could do
with a fair bit of refactoring, and this task would be so much easier
if Cython could generate the C-level ndarray code; we have precious
little developer resources available as it is, and would rather spend
it on solving problems than on arranging low-level API calls.

Having the following implemented would already be a vast improvement
on the current situation:

- Array indexing
x[1,2]
x[1:2,3:4]
x[1,...]
x[1,:]

- Assignment
x[1,2] = 3
x[1,...] = 1
...

- Calling array methods:
y = x.sum()

Doing this would be easier with Travis Oliphant's numpy developer's
reference at hand, and, if I recall the page on scipy.org (which is
currently down) correctly, he would provide it to you free of charge
on request.

I am very excited about your proposal, and I really hope it takes off.
Let us know if there is anything we can do to help.

Best of luck,
Stéfan
```