astropy/astropy — pull request #899 by astrofrog (2013-03-22 15:38:59+00:00)
Title: Attempt to fix bug with Quantity.__rmul__ and Numpy arrays

The current behavior of multiplying arrays with quantities is inconsistent:

```
In [4]: (3. * u.m) * np.array([1,2,3])
Out[4]:

In [5]: np.array([1,2,3]) * (3. * u.m)
WARNING: Converting Quantity object in units 'm' to a Numpy array [astropy.units.quantity]
Out[5]: array([ 3., 6., 9.])
```

the first behavior is correct. The problem is that the ``Quantity`` class needs ``__array_priority__`` to be set like ``Unit`` has, and this PR does this.

However, note that this doesn't yet work, because it seems that the ``__array__`` method takes precedence over even checking ``__array_priority__``. I'll look into it a bit more, but if anyone has any ideas, please let me know!