[Numpy-discussion] how to recognize a numpy-scalar type at the C level and how to convert

Sebastian Haase haase at msg.ucsf.edu
Tue Jan 16 14:42:11 EST 2007


Hi!
After converting to numpy my SWIG-wrapped code runs a bunch of error
of this type:

  TypeError: argument number 9: a 'float' is expected,
'numpy.float32(-2.10786056519)' is received

This comes of course from the fact that numpy introduced all these new
scalar types (addressing the shortcoming of the (few) scalar type
provided by standard python).

What would be an easy way to "recognize" such a scalar type in C-API
numpy code  and can I extract the C-scalar value from it ?

Thanks for any hints,
Sebastian Haase



More information about the NumPy-Discussion mailing list