On Thu, May 20, 2010 at 12:07 PM, Bruce Southey firstname.lastname@example.org wrote:
np.array is an array creating function that numpy.array takes a array_like input and it *will* try to convert that input into an array. (This also occurs when you give np.array a masked array as an input.) This a 'feature' especially when you don't use the dtype argument and applies to any numpy function that takes array_like inputs.
Ok. I can accept that.
I do not quantities, but you either have to get the user to use the appropriate quantities functions or let it remain 'user beware' when they do not use the appropriate functions. In the longer term you have to get numpy to 'do the right thing' with quantities objects.
I have done a bit of development on numpy to try to extend the __array_wrap__ mechanism so quantities could tell numpy how to do the right thing in many situations. That has been largely successful, but this issue we are discussing is demonstrating some unanticipated limitations. You may be right that this is a "user-beware" situation, since in this case there appears to be no way for an ndarray subclass to step in and influence what numpy will do with a list of those instances.