[Numpy-discussion] Proposed record array behavior: the rest of the story: updated
falted at pytables.org
Wed Jul 28 03:01:23 CDT 2004
A Dimarts 27 Juliol 2004 22:04, gerard.vermeulen at grenoble.cnrs.fr va escriure:
> Introducing recordArray["column"] as an alternative for
> recordArray.field("column") breaks a symmetry between for instance 1-d
> record arrays and 2-d normal arrays. (the symmetry is strongly suggested
> by their representation: a record array prints almost as a list of tuples
> and a 2-d normal array almost as a list of lists).
> Indexing a column of a 2-d normal array is done by normalArray[:, column],
> so why not recArray[:, "column"] ?
Well, I must recognize that this has its beauty (by revealing the simmetry
that you mentioned). However, mixing integer and strings on indices can
be, in my opinion, rather confusing for most people. Then, I guess that
the implementation wouldn't be easy.
> I prefer to use
> rather than recordArray["column"].
I would prefer better:
(note the use of the plural in fields and cols, which I think is more
consistent about its functionality)
The problem with:
is that I don't see it as natural and besides, completion capabilities
would be broken after the  parenthesis.
Anyway, as Russell suggested, I don't like recordArray["column"],
because it would be unnecessary (you can get same result using
Although I recognize that a recordArray.cols["column"] would not hurt
my eyes so much. This is because although indices continues to mix ints
and strings, the difference is that ".cols" is placed first, giving a new
(and unmistakable) meaning to the "column" index.
More information about the Numpy-discussion