Fernando Perez wrote:
Mmh, just curious: I wonder about the wisdom of that overloading of a 'magic' key (-1). It will make thinks like
for name in t.dtype.fields:
No real wisdom. More organic growth. Intially I didn't have an ordered list of fields, but as more complicated data-type descriptors were supported, this became an important thing to have. I should have probably added a n additional element to the PyArray_Descr structure. Remember, it was growing out of the old PyArray_Descr already and I was a little concerned about changing it too much (there are ramifications of changing this structure in several places). So, instead of adding a "ordered_names" tuple to the dtype object, I just stuck it in the fields dictionary. I agree it's kind of odd sitting there. It probably deserves a re-factoring and pulling that out into a new attribute of the dtype object. This would mean that the PyArray_Descr structure would need a new object (names perhaps), and it would need to be tracked. Not a huge change and probably worth it before the next release. -Travis