I am facing the opposite problem described here: http://docs.scipy.org/doc/numpy/user/basics.subclassing.html
In short, I want to create a class Dummy, inherited from np.ndarray, which returns a plain array whenever an instance is sliced or viewed. I cannot figure out how. I would really appreciate your help, here is a chunk of code, what is commented was an attempt which didn’t work out. Thanks a lot, Jacopo p.s. I can be more wordy in explain the problem i just dont want to overwhelm you. import numpy as np class Dummy(np.ndarray): def __new__(cls, array): obj=array.view(cls) return obj def __array_finalize__(self, obj): #self=self.view(np.ndarray) #self=np.asarray(self) d=Dummy(np.ones(5)) d2=d[:3] print type(d2) # I wish this was np.array _______________________________________________ NumPy-Discussion mailing list [email protected] http://mail.scipy.org/mailman/listinfo/numpy-discussion
