Chris Colbert wrote:
> so if I have:
>
> cdef class IplImage:
> cdef c_lib.IplImage* thisptr
>
>
> cdef class CvMat:
> cdef c_lib.CvMat* thisptr
>
> then I can just do this?
>
> def exposedPythonFunc(image): where image can be an IplImage or CvMat
> c_lib.cFunction(image.thisptr) since I know thisptr exists
>
> or must I do?
>
> def exposedPythonFunc(image):
> if isinstance(image, IplImage):
> c_lib.cFunction(image.thisptr)
>
> elif isinstance(image, CvMat):
> c_lib.cFunction(image.thisptr)
>
> else:
> raise NotImplementedError
Worse:
def exposedPythonFunc(image):
if isinstance(image, IplImage):
c_lib.cFunction((<IplImage>image).thisptr)
elif isinstance(image, CvMat):
c_lib.cFunction((<CvMat>image).thisptr)
...
Dag Sverre
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev