[PYTHON MATRIX-SIG] Building index tuples

David Ascher da@maigret.cog.brown.edu
Tue, 22 Oct 1996 10:04:51 -0400 (EDT)


> I like the new style of building up index tuples less and less.
> The bits and pieces I need are:
> 
> 1) The built-in function slice() that needs at least one argument
>    and shares the strange feature of range() that the *first*
>    argument is optional.
> 2) The special meaning of None as an argument to slice().
> 3) The object NewAxis, to be imported from Numeric.
> 4) The object Ellipses (soon to be Ellipsis), which is built-in in
>    Python 1.4.
> 
> *I* don't want to explain all this to a new user (whom I just told how
> terribly consistent Python is)!

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

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.

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?

This doesn't address the fact that NewAxis is None.  I agree that this
is confusing.

It doesn't address either the arrayrange(f=None,t,s=1,typecode=None)
oddity.  I've found that the uses of arrayrange I usually want are:

	arrayrange(10)
	arrayrange(10, typecode=Float)
	arrayrange(10, 20)   
	arrayrange(10, 20, typecode=Float)

which would be supported if arrayrange did kw recognition.  In fact I
wouldn't mind if

	arrayrange(10, Float)

was supported, but that violates the so-far consistent attitude towards
the fact that a function doesn't infer which argument is which by its
type.  IMHO, this is not necessarily a good thing, but I can see that
it's "different".

--david

=================
MATRIX-SIG  - SIG on Matrix Math for Python

send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
=================