astropy/astropy — pull request #1057 by mdboom (2013-05-07 01:30:08+00:00)
Title: Simplify units for multiplication and division of Quantities

This may have already been discussed and a determination made (so I will not be offended if this just gets closed as "already ruled on"), but I found this behavior surprising as I was reading through and making a units/quantities tutorial today.

This is the current behavior:

```
>>> (5.0 * u.m) * (2.0 * u.cm)

```

Personally I find that surprising -- I would have expected the equivalent units to simplify. "m cm" is an odd unit. Are there other examples of units that are made up of a multiplication of equivalent units that are in common usage?

The new behavior in this PR is:

```
>>> (5.0 * u.m) * (2.0 * u.cm)

```

that is, it takes the unit from the left hand side (and there is precedence for this already in the addition and subtraction operators on Quantity).

Division is also updated with the converse operation and will always return a dimensionless unit when the units are equivalent.

Any thoughts? Good reasons for status quo?