We have a class which is a subclass of ndarray which defines __array_finalize__ to add an attribute. The class looks something like this:
class UnitArray(ndarray): # ... def __new__(cls, data, dtype=None, copy=True, units=None): # ... arr = array(data, dtype=dtype, copy=copy) res = ndarray.__new__(cls, arr.shape, arr.dtype,buffer=arr) res.units = units return res def __array_finalize__(self, obj): if (isinstance(obj, UnitArray)): if hasattr(obj, 'units'): self.units = obj.units This works for all the ufuncs I've tried, but the result of concatenate is missing the units attribute. Is this a bug with concatenate, or expected behavior? The real class can be found here: https://svn.enthought.com/svn/enthought/trunk/src/lib/enthought/numerical_modeling/units/unit_array.py Bryce _______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion