[OT] pass a C callback function to a cythom module via python

Stéfan van der Walt stefan at sun.ac.za
Tue Mar 27 18:03:20 EDT 2012


Hi Nadav

I just had a chat with Dag, a core Cython contributor.  He mentioned
to me another alternative, which is to encapsulate the callback
function in a class:

https://github.com/dagss/cython-pydata12/blob/master/examples/oointegrate/integrate.pyx

You can import this class from Python, and pass it along as the
callback object.  There may be some work on improving this
functionality in the future, but for now I think that's the cleanest
route (and helps us to avoid ctypes!).

Stéfan


On Tue, Mar 20, 2012 at 1:02 AM, Nadav Horesh <nadavh.horesh at gmail.com> wrote:
>
> Can you explain in more details how can I implement it? Any case I am
> attaching an scheme that may clarify my intend. Soon I'll post a code
> demonstrating the problem.
>
>   Thank you,
>      Nadav,



More information about the scikit-image mailing list