[Numpy-discussion] metadata and metabehavior for arrays (for scipy.base or Numeric3)
Sébastien de Menten
sdementen at hotmail.com
Wed Apr 6 08:52:05 EDT 2005
>>
>>Maybe this one could be implemented using record array with a record like
>>(data, mask). However, it would be cumbersome to use. E.g.
>>a.field("data")[:] = cos( a.field("data")[:] ) instead of a[:] = cos(a[:])
>>with the current MA module
>
>Assuming "data" is the name of a field in a record array "a", why not have
>a.data to represent a view (or copy, depending on the convention adopted)
>of a column in a or a.data.Cos to provide the cosines of the values in the
>data column?
>
>"Cos" is used in place of "cos" to distinguish the method from the
>function. The former requires no parentheses.
>
Well, I think the whole point is to be able to use "without changes" any
library that manipulate arrays with "augmented arrays": same code for all
arrays independently of them being "naked" or "augmented".
The "without changes" and "any library" should be taken with a pinch of salt
as operation that are accepted for any array will not necessarily mean
something for some "augmented arrays".
On a side note, I rather prefer to keep mathematical notation instead of OO
notation ( cos as function vs method )
More information about the NumPy-Discussion
mailing list