[PYTHON MATRIX-SIG] RubberIndex

Konrad HINSEN hinsenk@ere.umontreal.ca
Mon, 4 Mar 1996 11:37:23 -0500


> The reason for a 'flat' attribute is that ravel(a) does not support
> _assignment_ to 'a' in flattened form.  An attribute or method is a
> more natural interface for changing an objects data members.  However,
> ravel(a) could provide this functionality if ravel(a) returned a
> reference instead of a copy.

I think that right now it does, but in my opinion it shouldn't, at
least not by default. For assignment in flattened form, my proposal
contains:

  2.1.3) Combining a group of axes into one axis (see comment 2):
  +      a[i1, i2, ......, i3, i4]  (see comment 3)
	   The double ellipsis works similar to the single one, but
	   contracts all the axes covered into a single axis.

This is more flexible, since it allows partially flattened forms,
and follows the principle "assignment only via indexing", which
I might add to the list of principles...

> The attribute would not fit your functions for everything so that
> scalars can be substituted for arrays. But if the flattened array is
> to be indexed (for assignment or selection) then scalars could not be
> supported anyway.

Which is another reason to do all assignments in the form of indexing,
such that indexing is the only operation not supported on scalars.

-------------------------------------------------------------------------------
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
=================