[Numpy-discussion] np.zeros(2, 'S') returns empty strings.
njs at pobox.com
Sun Jan 15 03:15:41 EST 2012
On Sat, Jan 14, 2012 at 2:12 PM, Charles R Harris
<charlesr.harris at gmail.com> wrote:
> This sort of makes sense, but is it the 'correct' behavior?
> In : zeros(2, 'S')
> array(['', ''],
I think of numpy strings as raw fixed-length byte arrays (since, well,
that's what they are), so I would expect np.zeros to return all-NUL
strings, like it does. (Not just 'empty' strings, which just means the
first byte is NUL -- I expect all-NUL.) Maybe I've spent too much time
working with C data structures, but that's my $0.02 :-)
More information about the NumPy-Discussion