Hi, I have the same problem as Martin DRUON, who wrote 10 days ago: > I have a problem with the ufunc return type of a numpy.ndarray derived > class. In fact, I subclass a numpy.ndarray using the tutorial : > http://docs.scipy.org/doc/numpy/user/basics.subclassing.html > > But, for example, if I execute the "max" ufunc from my subclass, the return > type differs from the return type of the numpy ufunc.
BTW: http://projects.scipy.org/numpy/ticket/1904 is meant to describe this, although the example code misses the actual calls to a1.min() and a2.min() in the assertion: # --------------------------------------------------- import numpy class Test(numpy.ndarray): pass a1 = numpy.ndarray((1,)) a2 = Test((1,)) assert type(a1.min()) == type(a2.min()), \ "%s != %s" % (type(a1.min()), type(a2.min())) # --------------------------------------------------- This code fails with 1.6.0, while it worked in 1.3.0. I tend to think that this is a bug (after all, a1.min() does not return ndarray, but an array scalar), but maybe there is also a good reason for this (for us, unexpected) behavor change and a nice solution? Have a nice day, Hans _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion