[PYTHON MATRIX-SIG] Slice expressions
Konrad Hinsen
hinsen@ibs.ibs.fr
Thu, 17 Oct 96 17:42:26 +0100
> 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]
Fine, but then you use another syntax. What I like about the
index_expression stuff is that it is exactly the indexing syntax
(except for simple slices), in all its variants, including
NewAxis, ellipses etc. Of course there is no reason not to
have both...
Konrad.
--
-------------------------------------------------------------------------------
Konrad Hinsen | E-Mail: hinsen@ibs.ibs.fr
Laboratoire de Dynamique Moleculaire | Tel.: +33-76.88.99.28
Institut de Biologie Structurale | Fax: +33-76.88.54.94
41, av. des Martyrs | Deutsch/Esperanto/English/
38027 Grenoble Cedex 1, France | Nederlands/Francais
-------------------------------------------------------------------------------
=================
MATRIX-SIG - SIG on Matrix Math for Python
send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
=================