[PYTHON MATRIX-SIG] Building index tuples

Konrad Hinsen hinsen@ibs.ibs.fr
Tue, 22 Oct 96 16:26:49 +0100


> I think you meant these are the bits and pieces you don't need, no?

These are the bits and pieces I must use but don't like.

> Methinks the most elegant solution to your qualms is to have NewAxis
> have the same privileged status as Ellipsis, i.e. a builtin type.  It's
> hard to see why guido would let that happen purely on 'esthetic'
> grounds.

I agree.

> An alternative is to do something like Numeric.Ellipses = Ellipses, that
> way at least we can 'pretend' that Ellipsis is like NewAxis and part of
> Numeric.  Is there a use for Ellipsis outside of Numeric?

Not as yet, but there might be. But then the same would be valid for
NewAxis. The only difference is that, for historical reasons, NewAxis
is None and Ellipsis is a special object. I don't really care about
that, but don't like that every user has to know these implementation
details. Setting Numeric.Ellipsis = Ellipsis would already be
a step toward unification. But then we should do the same with slice().
That leaves the weird interpretation of arguments by slice() as a problem.
At first sight making it compatible with range() seems clever, but
in reality it is never used like range(). In particular, range() always
needs an upper bound, whereas slice() doesn't. The syntax of slice()
should mirror as closely as possible the syntax of slice indexing, not
the syntax of range().

I suppose that I'll end up reintroducing my index_expression code; I
can just make a new module for that. It has the enormous advantage
that you don't have to know anything about the implementation details
of multidimensional indexing, except that index expressions are
sequences.

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