In python, I have numpy arrays a0, a1, and a2, each of which refer to different contents. I want to shift the relations between the reference names and the referred objects, so that a2 will now point to the content pointed by a1 before, and a1 will now point to the content pointed by a0 before. Then, I want to let a0 to point to a new content.
To be more specific, I want to do something like this:
import numpy as np
a2=np.array([1,2,3,4])
a1=np.array([10,20,30,40])
a0=np.array([8,8,8,8])
a2=a1
a1=a0
# I want to assign new values to a0[0], a0[1], .., without affecting a1.
Can I do it without copying values (e.g. by np.copy) and without memory reallocation (e.g. by del and np.empty)?
a0array? And where do the new values come from?a0array, and a modified version of it. The fact that you are reusing the names ('shifting') doesn't matter.