<div class="gmail_quote">On Sat, Jan 14, 2012 at 4:12 PM, Charles R Harris <span dir="ltr"><<a href="mailto:charlesr.harris@gmail.com">charlesr.harris@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

This sort of makes sense, but is it the 'correct' behavior?<br><br>In [20]: zeros(2, 'S')<br>Out[20]: <br>array(['', ''], <br>      dtype='|S1')<br><br>It might be more consistent to return '0' instead, as in<br>


<br>In [3]: zeros(2, int).astype('S')<br>Out[3]: <br>array(['0', '0'], <br>      dtype='|S24')<br><br>Chuck<br>
<br></blockquote><div><br>Whatever it should be, numpy is currently inconsistent:<br><br>>>> np.empty(2, 'S')<br>array(['0', '\xd4'], <br>      dtype='|S1')<br>>>> np.zeros(2, 'S')<br>

array(['', ''], <br>      dtype='|S1')<br>>>> np.ones(2, 'S')<br>array(['1', '1'], <br>      dtype='|S1')<br><br>I would expect '0''s for the call to zeros() and empty strings for the call to empty().<br>

<br>Ben Root<br><br></div></div>