[PYTHON MATRIX-SIG] Yorick, Python and Array.py
Sun, 12 Nov 95 13:30:58 -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?
I love the discussions that this list has generated, nonetheless I have
found that sometimes they remain a little bit too divorced from actual
implementations. I'm trying to implement some of the more interesting ideas
in the hopes of myself and others being able to play with them, not as an
attempt to impose a standard!
> 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.
This is a very good point.
> I've created a slice object to generalize the notion of start:stop:step
> 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
Gee Konrad, I thought you had been playing with my matrices. I already
allow lists of indices, and it's true, you can create generalized slices
using range. The slice object is there in order to make things a lot
easier. One thing that I really like about slices is that you can leave off
the start or end points, and have them assigned appropriately for the array
(just as in normal python slice indexing). This is a LOT easier to use
MATRIX-SIG - SIG on Matrix Math for Python
send messages to: email@example.com
administrivia to: firstname.lastname@example.org