I wrote the following program to test the behavior of Numpy array view:
import numpy as np
a = np.array(\[1, 2, 3, 4, 5, 6\])
b = a\[2:4\]
# print(type(a.data))
# print(dir(a.data))
print(a.data)
print(hex(id(a.data)))
print()
# print(type(b.data))
# print(dir(b.data))
print(b.data)
print(hex(id(b.data)))
print()
# print(hex(id(a.data)))
# print(hex(id(b.data)))
# print(b.base)
print()
But The address of ndarray's buffer displayed by “watch” in vscode debuger is always change,As shown in the following pictures.
It's also different from the function "print()" printed.
In my opinion,I think the address printed by function print() is right.But I don't konw why this happend.
Who can tell me why.