On Apr 21, 2009, at 12:45 AM, Jean-Francois Moulin wrote: > Hi, > > first of all, thanks for the replies. > > As for the first answer by Lisandro, I do not understand then why my > first code fragment at all works... > The only difference is that the function called has two params, one > instance of one of my classes and a numpy array, while the faulty > piece of code should be called on an instance > of one of my classes only... > > As for the second, from Robert, now, very well... how do I specify a > value for this implicit parameter then!? It is a bint I guess... I > tried to set it to 1 and got new error messages: > delay_line.pyx:961:30: Cannot assign type 'tuple (LstFileReader_FAST, > int __pyx_skip_dispatch, struct > __pyx_opt_args_12delay_line_C_18LstFileReader_FAST_next_ev > *__pyx_optional_args)' to 'tuple (*)(LstFileReader_FAST)'
You can't. I agree the errors are more cryptic than they should be, but C functions have no concept of runtime dispatching or default arguments, so it doesn't work to cast such a function to a C function (well, maybe one could hack it, but it'd be ugly and fragile). > I also tried to use cdef in all cases, I get no compile time error but > at runtime my object LstFileReader_FAST appears no longer to be > defined!? I do not understand because all the calls are made from > within Cython code... (so that I expect the cpdef is not really > needed) I am guessing you're doing something like a. LstFileReader_FAST(...) and it's complaining that "a has not attribute 'LstFileReader_FAST'". Usually this indicates that a is not typed correctly (e.g. it thinks a is an ordinary object). You can run cython with the -a option to easily see this kind of thing. - Robert _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
