I created a numpy array and tried to get its attributes with 'dict', but failed.
>>> import numpy as np
>>> a = np.arange(12)
>>> a.reshape(3,4)
array([[ 0,  1,  2,  3],
       [ 4,  5,  6,  7],
       [ 8,  9, 10, 11]])
>>> type(a)
<class 'numpy.ndarray'>
>>> a.__dict__
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'numpy.ndarray' object has no attribute __dict__. Did you mean: '__dir__'?
>>> '__dict__' in dir(a)
False
The document says that obj.dict is used to store an object's (writable) attributes. I know I can use dir(a) and getattr() to fetch all the attributes {k,v}. Also, all the attributes such as shape and itemsize can be derived from the array constructor and besides strides can be calculated like below:
def calStrides(self, shape, itemSize):
    loops = len(shape)
    print(f"calculating strides... loop times = {loops}")
    lst = []
    for i in range(loops):
        y = 1   #   first multiplicand
        for j in range(i + 1, loops):
            y *= shape[j]
        lst.append(y * itemSize)
    self.cal_strides = tuple(lst)
Does this make them 'read-only' (as opposed to assignment or 'writable')? Is that the reason why there is no dict provided for data inspection?
 
     
    