[Numpy-discussion] numpy subclass

Jacopo jacopo.pecci@gmail....
Thu Jul 23 12:13:26 CDT 2009

I am facing the opposite problem described here:

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,
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):
   return obj
def __array_finalize__(self, obj):

print type(d2) # I wish this was np.array   

More information about the NumPy-Discussion mailing list