astropy/astropy — pull request #794 by eteq (2013-02-19 14:28:47+00:00)
Title: Distance to quantity

Note that this is based on #793, so *only* the last commit is unique to this PR)

This makes the change of converting `Distance` objects in `coordinates` to subclass from `Quantity`. They already use the same internal naming scheme (`_value` and `_unit`), so no substansive changes are needed. As @astrofrog mentions in #793, though, this does mean `Distance` picks up the methods from `Quantity`.

An alternative approach (which wouldn't actually be *that* much more work) would be to drop the `Distance` class completely, and just require a `Quantity` that is a length. I'm mildly against this, because the current API is slightly more convenient - ``d.kpc`` is easier than ``d.to('kpc').value``. Also, with a `Distance` class, we can have the initializer that allows providing a `z`, and hopefully in the near future, `distmod` (and similar acessors). With a raw `Quantity` that's not possible.