I've been working with pyfits, which uses numpy chararrays. I've discovered the 
hard way that chararrays silently remove trailing whitespace: 

>>> a = np.array(['a '])
>>> b = a.view(np.chararray)
>>> a[0]
'a '
>>> b[0]
'a'

Note the string values stored in memory are unchanged. This behaviour caused a
bug in a program I've been writing, and seems like a bad idea in general. Is it 
intentional?

Neil


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

Reply via email to