[Cython] CEP1000: Native dispatch through callables

Dag Sverre Seljebotn d.s.seljebotn at astro.uio.no
Fri Apr 13 00:11:27 CEST 2012


Travis Oliphant recently raised the issue on the NumPy list of what 
mechanisms to use to box native functions produced by his Numba so that 
SciPy functions can call it, e.g. (I'm making the numba part up):

@numba # Compiles function using LLVM
def f(x):
     return 3 * x

print scipy.integrate.quad(f, 1, 2) # do many callbacks natively!

Obviously, we want something standard, so that Cython functions can also 
be called in a fast way.

This is very similar to CEP 523 
(http://wiki.cython.org/enhancements/nativecall), but rather than 
Cython-to-Cython, we want something that both SciPy, NumPy, numba, 
Cython, f2py, fwrap can implement.

Here's my proposal; Travis seems happy to implement something like it 
for numba and parts of SciPy:

http://wiki.cython.org/enhancements/nativecall

Obviously this is (in a modified form) PEP-material, but I think it is 
much better to just get it working with a nice range of tools first 
(makes the PEP application stronger as well).

Feedback most welcome!

Dag


More information about the cython-devel mailing list