def add(self):
    self.slice = slice(-len(self.view) - 1, self.base.size)
self.view = self.base[self.slice]
self.view[0] = 1

def __getstate__(self):
    return {'base': self.base, 'slice': self.slice}

def __setstate__(self, state):
    self.base = state['base']
self.slice = state['slice']
self.view = self.base[self.slice]

def __repr__(self):
    return str(self.view)
Unexpected behavior serializing Numpy array