Hi Ray,
> When I read in the string value, using a['string'][()], a Python string is
> returned, but if I needed to check the dtype before reading the value, then
> a value of 'O' is not particularly helpful. Is there a reason why a string
> dtype is not assigned?
The "O" type is used in this case because the dataset was created
using a Python string. In contrast to NumPy "S" dtype strings, Python
strings are stored in HDF5 as "variable-length" strings, and
represented with the "O" type.
To get a dataset using the NumPy "S" string type, use the
create_dataset method explicitly, or just assign a "numpy.string_" :
>>> a['npstring'] = numpy.string_("Hello")
>>> a['npstring'][()].dtype
dtype('S5')
Andrew