Hi!

I wrote a simple subclass of np.ndarray and now i do call np.sum() on it. I 
expected that the result will be a python float (or int) just like when summing 
up regular arrays. Instead i obtain the (scalar) view of my subclass. How can 
i change this behavior? I tried writing __array_wrap__ method like this: 

def __array_wrap__(self, out_arr, context=None):
        selfv = self.view(np.ndarray)
        return np.ndarray.__array_wrap__(selfv, out_arr, context)

but this just returns np.ndarray type and not float.

Regards,
-- 
Marek Wojciechowski 

_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to