[PYTHON MATRIX-SIG] Slices as :

James Hugunin jjh@Goldilocks.LCS.MIT.EDU
Wed, 31 Jan 96 10:56:04 EST


The following is mainly directed to Chris, but I thought that people
on the list might be interested, so I decided to include the CC.


Well, it looks like your slices patch is going to get itself added to
python after all.  Guido turned out to be a softer touch than I'd
expected.  If you'd been at the workshop when I started talking about
rubber indices, you'd better understand my fears.

I'd like to see a couple of changes to your slices patch to make my
life easier for adding it into the NumericPython distribution.

Could you prepare a version of your patches that include both 

1::2 -> slice(1,None,2) 
and
::: or .. (you pick, but it might get changed by popular vote)
	-> Py_Ellipses (a special object just like Py_None)

I'd also prefer to see 1:2:3:4 -> Syntax Error rather than a runtime
error.

I know that a[:] is unchanged by your patches for backwards
compatibilty.  It would be nice if a[::-1] would be turned into
a[slice(None,None,-1) so that it could be passed to the mapping
protocol rather than being a syntax error.

I don't think that pseudo indices should have special notation as
these are particular to the array object.  Konrad's name of
Numeric.NewAxis strikes me as a good idea.

I also don't think that it is necessary to add special notation for
the compressing rubber index as this is done easily enough with
reshape when needed.

Does this all sound reasonable to you?

Could you prepare this as a patch on top of the 0.32 distribution (on
top of Konrad's existing patches)?  

As soon as you get this patch to me I'll add it into my working
version and to the next distribution.

I understand other commitments, but the sooner you could get this to
me the better.

Thanks for your help - Jim


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

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