[PYTHON MATRIX-SIG] Pseudo Indices

Guido van Rossum guido@CNRI.Reston.VA.US
Tue, 30 Jan 1996 13:09:42 -0500

> ie. b[2, PseudoIndex] <--> b.reshape(2, 1)

I'm not sure I understand reshape completely, but isn't this a rather
drastic reinterpretation of the index arguments when a pseudo index is
present?  In general, if no pseudo index is present, single indices
take away that dimension, don't they?  (While slice indices can reduce
the length in that dimension but otherwise leave it intact.)  But in
your example, the '2' becomes a shorthand for a slice.  I don't like
this very much...

> I'd really like to be able to say c[:, 3] -> array([3,13]).  Python
> syntax doesn't currently allow this, so until somebody convinces Guido
> to make the change, the following objects are used instead.

Same comment -- I don't like the '3' index to turn into a slice by
context, if I understand this right.  (Bear with me, I'm not even sure
that array([3, 13]) really is a 3x13 matrix.)

> c[:, 1:2] --> c[Slice(), Slice(1,2)]

This is fine (and what I thought you were proposing all the time).  I
would consider a patch if the existing 1-dim sequence and mapping
types are not affected.

> a[RubberIndex, 3].

You could sneak this into the abovementioned patch as "a[::, 3]".

> (until somebody lobbys Guido for a better system).

Ain't I nice today? ;-)

--Guido van Rossum <guido@CNRI.Reston.VA.US>
URL: <http://www.python.org/~guido/>

MATRIX-SIG  - SIG on Matrix Math for Python

send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org