[PYTHON MATRIX-SIG] Yorick, Python and Array.py

Hinsen Konrad hinsenk@ere.umontreal.ca
Sun, 12 Nov 1995 12:22:18 -0500


   I'm creating special objects All, Empty, Star, and Dot in order to capture  
   the capabilities of Yorick for array subscripting.

I confess that I have not yet completely studied all the discussion
about indexing, but let's not get carried away to fast with
implementations.  We are not creating matrices for Yorick users, but
for Python, so the notation we introduce should make sense without
referring to Yorick.  "All" and "Empty" are fine, but how should
anyone make sense of "Star" and "Dot" without learning Yorick first?

We should first agree on what features we want (preferably based on
real use in other matrix languages) and then think about a notation
for them that fits into Pythons general structure. For example, I
don't like the idea of having '-' standing for anything else than
a mathematical operation; once we start with this, we'll soon have
a Perl-compatible letter soup.

   I've created a slice object to generalize the notion of start:stop:step indexing.

That's not the worst solution, but maybe there is a better one. How
about permitting lists of indices? That would include the generalized
slices if range() is used to create the list. But it would also allow
much more general indexing schemes without any further effort. It is
probably a bit less efficient, but are generalized slices really used
in time-critical parts of matrix algorithms? (Honest question, I don't
know!)

   The principle problems with this system are potential naming conflicts (or  
   really ugly names like Matrix.Star) and the ugliness of Slice(None,None,2)  
   vs. ::2.

Indeed. It would not be too difficult to allow ::2 as valid syntax,
but that raises the question of what this means for other Python
objects. For consistency it should be implemented everywhere. Is
anyone volunteering to do that?

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