Thu, 20 May 2010 13:04:11 -0700, Keith Goodman wrote:
Why do the follow expressions give different dtype?
np.array([1, 2, 3], dtype=str)
array(['1', '2', '3'], dtype='|S1')
np.array(np.array([1, 2, 3]), dtype=str)
array(['1', '2', '3'], dtype='|S8')
Scalars seem to be handled specially. Anyway, automatic determination of the string size is a bit dangerous to rely on with non-strings in the array:
When I looked at this the last time, it wasn't completely obvious how to make this to do something more sensible.