What is going on here? How can I check that a has length?
>>> import numpy as np
>>> a = np.array(3)
>>> hasattr(a , '__len__')
True
>>> len(a)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: len() of unsized object
Here, python considers a to not have length:
>>>a.shape
()
I am using python 2.7.3 and numpy 1.8.0.
Thanks.