omers66:

self.mem_y[2:None] = self.mem_y[0:-2]


I think, this is because the assignment is done by reference.
In the above statement, consider that every element is copied one by one. Hence, self.mem_y[0] will be copied to self.mem_y[2]. self.mem_y[1] to self.mem_y[3]. Note that self.mem_y[2] is already changed. Hence the changed value (self.mem_y[2]) is copied to self.mem_y[4] and so on.
You can avoid this confusion by
self.mem_y[2:None] = self.mem_y[0:-2].clone()