2009/7/29 Ernest Adrogué eadrogue@gmx.net:
Hello,
Suppose I want to store some data (a non-negative integer) related to an "event" involving two entities. It occurs to me that the way to do it is using a 2-d array, like a table:
For example:
a b c a 1 b 2 0 c 5
in the event 'b-a' the data is 2, and in the event 'c-a' is 5, etc.
Now, I need to be able to differentiate between 0 and 'no data'. I know I could use a number like -1, but this would affect arithmetic operations on the array, and also I need that indexing one such location with no data returns an empty array.
Is it possible to do this with the standard array class?
Not really. Use masked arrays. Or use a dictionary.