Original reporter: Cpascual
It would be nice if '|S1' was accepted as a synonym of 'char' when passing dtype to napi functions.
See attached patch to 4.2rc2 napi.py
Rationale:
Currently one can use numpy.dtype objects wherever a napi function requires dtype except for the case of string data.
This is because the numpy-->nexus data type conversion is done through
In the case of numpy 1-character arrays, str(dtype) returns '|S1', so at least this case can be covered pretty easily by using the proposed patch.
Note that this only works for numpy 1-character arrays, not for python strings. But at least one can convert to an array using:
numpy.array(tuple(string))
Original reporter: Cpascual
It would be nice if '|S1' was accepted as a synonym of 'char' when passing dtype to napi functions.
See attached patch to 4.2rc2 napi.py
Rationale:
Currently one can use numpy.dtype objects wherever a napi function requires dtype except for the case of string data.
This is because the numpy-->nexus data type conversion is done through
In the case of numpy 1-character arrays, str(dtype) returns '|S1', so at least this case can be covered pretty easily by using the proposed patch.
Note that this only works for numpy 1-character arrays, not for python strings. But at least one can convert to an array using: