[Numpy-discussion] isbuiltin - failure of understanding
Tue Feb 24 15:04:54 CST 2009
I was just trying to write a docstring for np.dtype.isbuiltin, when I
realized I didn't understand it.
As far as I can see, isbuitin should return:
0 for structured array dtypes
1 for types compiled into numpy
2 for extension types using the numpy C-API type extension machinery.
Here's the C code:
static PyObject *
val = 0;
if (self->fields == Py_None) val = 1;
if (PyTypeNum_ISUSERDEF(self->type_num)) val = 2;
But, why is this?
In : dt = np.dtype('S1')
In : dt
In : dt.isbuiltin
In : print dt.fields
In : print dt.fields == None
Same for np.dtype('U1')
More information about the Numpy-discussion