# [PYTHON MATRIX-SIG] flattened array indexing

**Chris Chase S1A
**
chris.chase@jhuapl.edu

*Mon, 13 Nov 1995 18:12:44 -0500*

I had suggested before that the "[]" syntax support both
multi-dimensional product indexing and flattened array indexing.
However, with the proposed
M[i,j] <-> M[(i,j)]
trying to also implement flattened indexing with the same syntax could
cause some problems. Instead it might be better to have a separate
M.flat(i) method for flattened indexing.
I would then assume when i is a scalar M[i] is "hierarchical" indexing
like Jim Fulton has suggested (i.e. M[i] returns a one lower
dimensional array)
I assume that if M has 3 dimensions then M[1,2] would be an error for
not specifying the correct number of indexes. A question:
M 1-dimensional.
i = (1,2,3)
Is the following a "wrong number of indexes" error or will 1D arrays
be treated differently?
M[i] <-> M[(1,2,3)]
Would one have to resort to:
M[(i,)] <-> M[((1,2,3))] ?
Chris Chase
=================
MATRIX-SIG - SIG on Matrix Math for Python
send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
=================