On Jan 3, 2009, at 16:57 , Dag Sverre Seljebotn wrote: > Another thing you could do is create your own mini-array Cython > class. E.g.: A class "DoubleArray" has C fields "ptr" and "len", and > a subclass "PyDoubleArray" allows initializing those using a Python > list (and managing the memory needed to hold the converted result > etc.). That's about 20 lines, nothing fancy... > > So from the unit tests you'd pass inn "PyDoubleArray" and from > Cython code raw "DoubleArray".
Cool idea. I thought about using some form of struct, but I didn't think quite hard enough, I guess (i.e., the subclassing bit :) > Your methods could then be "cpdef" and use the same interface. Indeed. If it turns out that this double array is the main cause of "wrapping", that would save me quite a bit of cookie-cutter conversion code (as it might apply to several methods). > Doesn't quite work out if you want to create C-callable code though. Right. Not an issue for now; I guess I'll just deal with that if it crops up. Thanks, - M -- Magnus Lie Hetland http://hetland.org _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
