[Numpy-discussion] Empty strings not empty?
Tue Dec 29 19:20:12 CST 2009
> x = "¥00"
> arr = np.array([x])
> lst = [x]
> arr == x # False
> arr == "" # True
> lst == x # True
> lst == "" # False
Ah - thanks - got it.
>> 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
> Array size of 0 would be very weird: it means it would have no items,
> whereas it actually has one item (which itself has a size 0).
Is this a string-specific thing? I mean, you can have size 0 1d
numeric arrays. Sorry if I'm being slow, it's late here.
In : np.array([]).shape
Out: (1, 0)
In : np.array([]).size
More information about the NumPy-Discussion