[PYTHON MATRIX-SIG] RubberIndex
Chris Chase S1A
chris.chase@jhuapl.edu
Wed, 14 Feb 1996 11:56:02 -0500
>>>>> "Konrad" == Konrad HINSEN <hinsenk@ere.umontreal.ca> writes:
Konrad> In fact, I would prefer to eliminate a[0] in preference of
Konrad> a[0,...]. I do not like the fact that an error is not
Konrad> generated if I use to few indexes. For example, suppose
Konrad> 'a' has shape (2,4,5,6). I want the
Konrad> You certainly have a point, but it also makes sense to keep
Konrad> the usability of arrays as sequence objects. For example, you
Konrad> can now iterate over the first axis of an array with
Konrad> for x in array([[1,2],[3,4]]): print x*x
It would be better to have an iterator method that would allow one to
access regular sub-arrays. At the minimum it would allow you to
specify iteration along any chosen dimension (i.e. a.iterator(dim)).
I am not sure how to extend it to allow iterating over other
sub-arrays (e.g. 2x2 sub-matrices).
Konrad> Also, most array functions accept nested lists as well as arrays.
Konrad> I'd like to keep this analogy as far as possible.
Generating an error when using too few indexes when subscripting an
array does not prohibit using nested lists as arguments to array
functions.
Chris
=================
MATRIX-SIG - SIG on Matrix Math for Python
send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
=================