Hi,

how do I access the kind of the data from cython, i.e. the single
character string:

'b' boolean
'i' (signed) integer
'u' unsigned integer
'f' floating-point
'c' complex-floating point
'O' (Python) objects
'S', 'a' (byte-)string
'U' Unicode
'V' raw data (void)

In regular Python I can do:

In [7]: d = np.dtype('S')

In [8]: d.kind
Out[8]: 'S'

Looking at the definition of dtype that comes with cython, I see:

  ctypedef class numpy.dtype [object PyArray_Descr]:
      # Use PyDataType_* macros when possible, however there are no macros
      # for accessing some of the fields, so some are defined. Please
      # ask on cython-dev if you need more.
      cdef int type_num
      cdef int itemsize "elsize"
      cdef char byteorder
      cdef object fields
      cdef tuple names

I.e. no kind.

Also, i looked for an appropriate PyDataType_* macro but couldn't find one.

Perhaps there is something simple I could use?

best,

V-
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to