astropy/astropy — pull request #1412 by mhvk (2013-09-06 04:38:38+00:00)
Title: Decompose/rescale on floor division of quantities by units -- alternative to conversion members?

In #1326, there has been discussion on whether/when/how many conversion members to include with quantities. I wondered if much of the wished-for convenience couldn't be gotten in a way that neither pollutes name space, nor sets us up for problems once quantities have uncertainties. So, as a trial, I defined `__floordiv__` for quantities (which was not yet defined), to behave a bit like `__div__` in that division by strings/Units is treated like a division by a quantity 1 of that unit, but with the difference that the unit is decomposed and the value rescaled. Hence, with this addition,
```
In [1]: import astropy.units as u

In [2]: l = u.Quantity(10.,"pc")

In [3]: l/'m'
Out[3]:

In [4]: l//'m'
Out[4]:

In [5]: l//u.au
Out[5]:
```
It seems to me this is a safe addition, no matter what is decided on #1326, and, for me at least, finally a reason to like the idea of multiplication/division by strings (contrary to my sentiment in #1408).