[Numpy-discussion] recarray field names
erin.sheldon at gmail.com
Sat Jul 8 10:23:15 CDT 2006
It was suggested that I put off this discussion until we were closer
to the 1.0 release. Perhaps now is a good time to bring it up once
again? The quick summary: accessing field names has some
oddness that needs cleaning up.
On 3/15/06, Travis Oliphant <oliphant at ee.byu.edu> wrote:
> 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.
More information about the Numpy-discussion