[PYTHON MATRIX-SIG] Mutli-dimensional indexing and other comments
Hinsen Konrad
hinsenk@ere.umontreal.ca
Wed, 4 Oct 1995 15:03:40 -0400
specification via an index argument. Could the rank be overriden
using a keyword argument instead of an index argument,
e.g. product.over(b,rank=1)? Since keywords are commonly used to
override default arguments this would seem a natural possibility.
I have never used keyword arguments, but that's no reason not
to use them ;-) Basically the idea is not bad; however, it lacks
one useful feature of my implementation: it is not possible to
create function objects with modified ranks if the rank is only
supplied in the function call.
Whenever I need a particular function/rank combination often,
I just define a new function, e.g.
reshape_items = reshape[[-1,1]]
reshape_items(range(5),[2,2])
gives the result
0 0
0 0
1 1
1 1
2 2
2 2
3 3
3 3
4 4
4 4
This is useful not just to save typing, but also to give meaningful
names to nonobvious array functions, which helps to make the code
more readable.
-------------------------------------------------------------------------------
Konrad Hinsen | E-Mail: hinsenk@ere.umontreal.ca
Departement de chimie | Tel.: +1-514-343-6111 ext. 3953
Universite de Montreal | Fax: +1-514-343-7586
C.P. 6128, succ. Centre-Ville | Deutsch/Esperanto/English/Nederlands/
Montreal (QC) H3C 3J7 | Francais (phase experimentale)
-------------------------------------------------------------------------------
=================
MATRIX-SIG - SIG on Matrix Math for Python
send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
=================