astropy/astropy — pull request #819 by mdboom (2013-12-10 15:43:59+00:00)
Title: Make sure dtype.names ends up with  the "name" attribute instead of "id"

This is prompted by a question by Susana Sanchez on the astropy mailing list (http://mail.scipy.org/pipermail/astropy/2013-February/002303.html) - see that discussion for additional info.

The current VOTable behavior is that if you have an XML VO Table with `FIELD`s that have both an `ID` attribute and a `name` attribute, when `io.vo` parses the file, it puts both the `name` and the `id` in the resulting numpy dtype. That is, for a particular example where the id's are "col#", the first entry of the thing that comes from `table.dtype` is ``('CIG Number', 'col1'), '|O8')``. This is all fine so far - it's good to record both of those.

The problem is that if you then do ``table.dtype.names``, the resulting list has the `ID`s, not the `name`s from the XML `Field`. It seems more natural for the `name` attribute to end up as the numpy dtype's name.

If I understand multi-name dtypes, I think the fix is to simply construct the dtypes so that the *last* name for each column is the `name` attribute, rather than the *first*. But @mdboom will likely know if this might have unintended side effects.

I'm not sure if this is a bug or feature request, as I'm not sure if this is intended or not.