Hi all, Should we document character arrays? Does anybody still use them?
I think their behaviour can largely be duplicated by object arrays. They also seem to be broken: >>> x = np.array(['1', '2', '3', '4']).view(np.chararray) >>> x*3 chararray(['111', '222', '333', '444'], dtype='|S4') All good, but: >>> x = np.array(['12', '34', '56', '78']).view(np.chararray) >>> x * 3 chararray(['1212', '3434', '5656', '7878'], dtype='|S4') Whereas with object arrays: >>> np.array(['12', '34', '56', '78'], dtype=object) * 3 array([121212, 343434, 565656, 787878], dtype=object) Similaryly: >>> x.rjust(3) chararray([' a', ' b', ' c', ' d'], dtype='|S3') >>> x = np.array(['a','b','c','d']).view(np.chararray) >>> x.rjust(3) chararray([' a', ' b', ' c', ' d'], dtype='|S3') But then >>> x = np.array([['ab','cd'], ['ef','gh']]).view(np.chararray) >>> x.rjust(5) # BOOM Cheers Stéfan _______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion