[Numpy-discussion] how to recognize a numpy-scalar type at the C level and how to convert
Sebastian Haase
seb.haase at gmx.net
Fri Jan 19 19:22:11 CST 2007
Hi again,
I finally bought the numpy-book.
Browsing through the 370 pages I found this:
PyArray IsScalar (op, cls)
Evaluates true if op is an instance of Py<cls>ArrType Type.
Is this what I need to check for a given scalar type.
Numpy is really much more extensive (comprehensive) than I thought.
Thanks,
Sebastian Haase
On 1/16/07, Sebastian Haase <haase at msg.ucsf.edu> wrote:
> 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