[Numpy-discussion] Proposed record array behavior: the rest of the story: updated
falted at pytables.org
Wed Jul 28 11:16:12 CDT 2004
A Dimecres 28 Juliol 2004 15:59, Gerard Vermeulen va escriure:
> Two points:
> 1. This is true for vanilla Python but not for IPython-0.6.2:
> You see, the completion mechanism of ipython recognizes d['Francesc'] as an
Ok. That's nice. IPython is more powerful than I realized :)
> 2. If one accepts that a "field_name" can be used as an attribute,
> one must be able to say:
> record.field_name ( == record.field("field_name") )
> and (since recordArray returns a record) also:
> and not
> recordArray.cols.field_name (sorry, I abhor this)
Mmm, maybe are you suggesting that the records.Record class had all its
methods starting by a reserved prefix (like "_" or better, "_v_" for attrs
and "_f_" for methods), and forbid that field names would start by these
prefixes so that no collision problems would occur with field names?.
Well, in such a case adopting this convention for records.Record objects
would be far more feasible than doing the same for records.RecArray objects
just because the former has very few attrs and methods. I think it's a good
> > Anyway, as Russell suggested, I don't like recordArray["column"],
> > because it would be unnecessary (you can get same result using
> > recordArray[column_idx]).
> Thank you for this little slip, you mean recordArray["column"] is
> recordArray[column_idx], isn't it?
Uh, my bad. I was (badly) trying to express the same than Russell Owen on
a message dated from 20th July:
I think recarray[field name] is too easily confused with
recarray[index] and is unnecessary.
> I think that we agree that recordArray.cols["column"] is better than
> recordArray["column"], but I don't see why recordArray.cols["column"] is
> better than the original recordArray.field("column").
Good question. Me neither. You are proposing just keeping
recordArray.cols.column as the only way to access columns?
> PS: after reading the above, there may be a case to accept only indexing
> which can be read from left to right, so
> recordArray.field_name is OK, but recordArray.field_name is not.
Sorry, I don't see the point here (it is most probably my fault given the
hours I'm writing this :(. May you elaborate that?
More information about the Numpy-discussion