[Numpy-discussion] how to work with numpy.int8 in c

David Cournapeau david at silveregg.co.jp
Tue Mar 2 20:58:31 EST 2010


David Cournapeau wrote:
> James Bergstra wrote:
> 
>>
>> Maybe I'm missing something... but I don't think I want to create an 
>> array.
> 
> Ah, I misunderstood your question. There are at least two ways:
> 
> PyObject *ret;
> ret = PyArrayScalar_New(UInt8);
> 
> Or
> 
> PyObject *ret;
> PyArray_Descr *typecode;
> 
> 
> typecode = PyArray_DescrFromType(PyArray_UINT8);
> ret = PyArray_Scalar(NULL, typecode, NULL);
> Py_DECREF(typecode);

^^^^ Sorry, this is wrong, this does not work on my machine, but I am 
not sure to understand why.

cheers,

David



More information about the NumPy-Discussion mailing list