[PYTHON MATRIX-SIG] Slice expressions
Perry A. Stoll
pas@lems.brown.edu
Thu, 17 Oct 1996 10:52:06 -0400 (EDT)
On Thu, 17 Oct 1996, Konrad Hinsen wrote:
> > I keep making this mistake...can someone put some documentation somewhere
> > that this index_expression _must_ be indexed with all three numbers to ensure
> > correct results, which is not the case with an actual array object.
> >
>
> Unfortunately there is no way to remove that restriction completely.
Agree, not within the index_expression_class. How about going back to
something from NumPy.03? to make it a little more forgiving:
def slice_generator(i=None, j=None, k=1):
if i == None:
if j == None:
return index_expression[::k]
else:
return index_expression[:j:k]
else:
if j == None:
return index_expression[i::k]
else:
return index_expression[i:j:k]
-Perry
=================
MATRIX-SIG - SIG on Matrix Math for Python
send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
=================