On 15. jan. 2012, at 01:21, josef.p...@gmail.com wrote: > On Sat, Jan 14, 2012 at 5:25 PM, Benjamin Root <ben.r...@ou.edu> wrote: >> On Sat, Jan 14, 2012 at 4:16 PM, Benjamin Root <ben.r...@ou.edu> wrote: >>> >>> On Sat, Jan 14, 2012 at 4:12 PM, Charles R Harris >>> <charlesr.har...@gmail.com> wrote: >>>> >>>> This sort of makes sense, but is it the 'correct' behavior? >>>> >>>> In [20]: zeros(2, 'S') >>>> Out[20]: >>>> array(['', ''], >>>> dtype='|S1') >>>> >>>> It might be more consistent to return '0' instead, as in >>>> >>>> In [3]: zeros(2, int).astype('S') >>>> Out[3]: >>>> array(['0', '0'], >>>> dtype='|S24') > > > > I would be surprised if zeros is not an empty string, since an empty > string is the "zero" for string addition. > multiplication for strings doesn't exist, so ones can be anything even > literally '1'
My python disagrees. In [1]: 2 * 'spam ham ' Out[1]: 'spam ham spam ham ' Not sure what the element-wise numpy array equivalent would be, though. Paul _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion