[Numpy-discussion] Project for Cython integration with NumPy

Dag Sverre Seljebotn dagss at student.matnat.uio.no
Tue Apr 1 16:48:30 EDT 2008


> I can foresee certain situations under which we can predict the type
> of the result of operations like this one.  Would it be possible to
> then handle 'y' as an ndarray as well, instead of reverting to Python
> object calls?
>   
Indeed - plans are underway to add automatic type inference to Cython. 
It is all about developer resources etc. (the preliminaries can be done 
in another GSoC project that we hope to get accepted).

When/if that happens, a lot of typing will not be necesarry, including 
this case. This will be an automatic consequence of Cython compiler 
development and not something that would need to be specifically for the 
case of NumPy (well, one declares would some more operator and function 
type signatures for NumPy, and then it would work).

Basically one would then only need to declare the type of arguments to 
the function, while local variables would be inferred automatically. 
(Getting around this is impossible, though we might add a different 
syntax for type declaration (using decorators) so that the same code can 
also be run using the Python interpreter.)

Perhaps in a year or so, if the current GSoCs are accepted :-) no 
promises though.

-- 
Dag Sverre




More information about the NumPy-Discussion mailing list