[Numpy-discussion] Proposed record array behavior: the rest of the story
falted at pytables.org
Thu Jul 22 02:47:27 CDT 2004
I agree that numarray team's overhaul of RecArray access modes is very good
and I agree most of it.
A Dimarts 20 Juliol 2004 19:14, Russell E Owen va escriure:
> I think recarray[field name] is too easily confused with
> recarray[index] and is unnecessary.
Yeah, maybe you are right.
> I suggest one of two solutions:
> - Do nothing. Make users use field(field name or index)
> - Allow access to the fields via an indexable entity. Simplest for
> the user would be to use "field" itself:
> (i.e. field becomes an object that can be called or can be accessed
> via __getitem__)
I prefer the second one. Although I know that you don't like the __getattr__
method, the field object can be used to host one. The main advantage I see
having such a __getattr__ method is that I'm very used to press TAB twice in
the python console with its completion capabilities activated. It would be a
very nice way of interactively discovering the fields of a RecArray object.
I don't know whether this feature is used a lot or not out there, but for me
is just great. I understand, however, that having to include a map to
suport non-vbalid python names for field names can be quite inconvenient.
More information about the Numpy-discussion