astropy/astropy — pull request #1616 by mdboom (2013-10-21 14:12:24+00:00)
Title: BUG is_equivalent for units sometimes fails

@mdboom - there is an odd problem with `is_equivalent`:
```
In [1]: import astropy.units as u

In [2]: (u.Jy*u.m).is_equivalent(u.m*u.Jy)
Out[2]: False

In [3]: (u.Jy*u.m)._get_physical_type_id()
Out[3]: (('kg', 1.0), ('m', 1.0), ('s', -2.0))

In [4]: (u.m*u.Jy)._get_physical_type_id()
Out[4]: (('m', 1.0), ('kg', 1.0), ('s', -2.0))
```
In `_get_physical_type_id()`, one finds
```
def _get_physical_type_id(self):
"""
Returns an identifier that uniquely identifies the physical
type of this unit. It is comprised of the bases and powers of
this unit, without the scale. Since it is hashable, it is
useful as a dictionary key.
"""
unit = self.decompose()
r = zip([x.name for x in unit.bases], unit.powers)
# bases and powers are already sorted in a unique way
# r.sort()
r = tuple(r)
return r
```
but apparently the statement that bases and powers are stored in a unique way is not (no longer?) True. Any ideas?