astropy/astropy — pull request #1540 by mhvk (2013-10-08 03:01:37+00:00)
Title: Sample implementation allowing Quantity initialisation from Columns

This follows a question from @taldcroft in #732 whether one could set a Quantity with a table column. With this:
```
from astropy.table import Table; import astropy.units as u
t = Table([[1.,2.],[3.,4.]], names=('a','b'))
t['a'].unit = u.km
u.Quantity(t['a']), u.Quantity(t['a'], u.m), u.Quantity(t['b']), u.Quantity(t['b'], u.Mpc/u.m)
```
yields
```
(,
,
,
)
```
Hence, an unset unit is taken as "treat this as a float array" rather than dimensionless unscaled.

Notes:
1) This trial implementation goes the route of making quantity initialisation duck type; instead of looking whether one is dealing with a `Quantity` instance, it looks whether there is an `unit` attribute; the one extra part required was for `Column` to have a `value` attribute (just equal to `data`).
2) Miraculously, it doesn't break any test cases!