Could anyone give me a tip on how to convert a python function
of the form

def func(x):
    return some_operation(x)

to a C function of the form

cdef void cfunc(double x, double *y):
    y = some_operation(x)

That is I want to be able to turn a python function into
a C function with pass by reference return semantics.

I looked at the cheesefinder example, and I am not sure how to adapt it, as I
want to be able to have the user supply the python function, and I can't think
of how to make a cdef callback function that knows what this function is, that
is

cdef void callback(souble x, double *y):
    y = func(x)

I am not sure how to set func in this way, without rewriting the cdef each
time. In python I would just use a higher order function . . .

Thanks,
Gabriel
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to