I was coding in numpy and had a question that made me think about the structure of the package and how methods are implemented. Here I give basic methods to illustrate my point:
import numpy as np
a = np.array([1, 2, 3])
b = np.ones(3)
It is possible to do either a.dot(b) or np.dot(a, b).
However, it is only possible to do np.multiply(a, b) since multiply is not an attribute of numpy.ndarray.
I was wondering, if the dot is twice defined as a static method and non-static one under the numpy.ndarray class, and np.multiply as a pure static method? Then, it is part of the class and instance, and the use of both ways is justified.
Then, I figured out that the dot method is part of the numpy.core.multiarray.dot and there is no such decorator as static. However, it is wrapped by some other C function. Is there any explanation on how things are internally implemented that justify this case? How is the big picture package structure of numpy?
