[Numpy-discussion] C-extension -- how do I accept a vector of both type double and type int?

Geoffrey Zhu zyzhu2000@gmail....
Thu Jul 26 17:28:04 CDT 2007


Hi Everyone,

I finally build a C extension. The one problem I found is that it is
too picky about the input. For example, it accepts
array([1.0,2.0,3.0]) with no problem, but when I pass in
array([1,2,3]), since the dtype of the array is now int, my extension
does not like it.

How do I handle this situation? Is there any way to access any data
type that can be converted into a double?

Thanks,
cg


More information about the Numpy-discussion mailing list