[Numpy-discussion] Empty strings not empty?

Matthew Brett matthew.brett@gmail....
Tue Dec 29 18:33:53 CST 2009


> Ok, it looks like there are at least two issues:
>  - if an item in a string array is set to '¥x00', this seems to be
> replace with '', but '' != '¥x00']

Sorry - I'm afraid I don't understand.  It looks to me as though the
buffer contents of [''] is a length 1 string with a 0 byte, and an
array.size of 1 - is that also what you think?  I guess I think that
it should be a length 0 string, with a array.size of 0,

> What do you need this for ?

I noticed it when I found that writing an empty string array to matlab
resulted in a single character array when loaded into matlab.   I
guess that I will have to special-case the writing code to detect
'empty' strings, but I can't (I don't think) distinguish a real string
with \x00 from an empty string.

Thanks a lot,


More information about the NumPy-Discussion mailing list