[SciPy-Dev] Documentation to use LowLevelCallable from cython

Pauli Virtanen pav at iki.fi
Sun Feb 18 09:03:31 EST 2018


su, 2018-02-18 kello 22:40 +1100, Andrew Nelson kirjoitti:
> I was wondering if there was a guide to demonstrate how to use a
> LowLevelCallable from cython? Is it possible, and does it lead to any
> speed
> benefits if all looping is done from cython?

There are some examples in the source code:

https://github.com/scipy/scipy/blob/master/scipy/_lib/_ccallback_c.pyx#
L107

I'm not sure what you precisely mean by "all looping is done from
cython", but using direct C calls instead of Python calls will give a
speedup. The main point of this all is to allow *users* to pass in C
callback routines using whatever FFI they are using, including Cython.

Cython itself AFAIK does not have something similar builtin --- you
cannot pass in a Cython cdef routine to another Cython routine from
Python.

	Pauli



More information about the SciPy-Dev mailing list