From: Jin W. P. <jw...@ae...> - 2002-03-06 18:02:16
|
I was working on an external module build in C where a function returns a 2-D integer array. However, when I imported module, I found a strange behavior concerning the type of the element of the array. This is what basically happens: static PyObject* foo(PyObject* arg, PyObject* args) { PyObject* a; int dims[2]={2,2}; a = PyArray_FromDims(2,dims,PyArray_INT); return a; } in python, >>> a=foo() >>> type(a[0,0]) <type 'array'> I expected the type 'int'. If you make a Numpy array in python, then you get the expected type of 'int'. >>> b=array([[0,0],[0,0]]) >>> type(b[0,0]) <type 'int'> Is this somehow intended? Thanks for any info, -- +----------------------------------------+ | Jin Woo Park (jw...@ae...)| | Research Assistant,Dept.Aerospace Eng. | | Seoul National University, Korea | +----------------------------------------+ |