[Python-Dev] PEP 203 Augmented Assignment
Guido van Rossum
guido@beopen.com
Fri, 28 Jul 2000 06:47:29 -0500
> Ka-Ping Yee <ping@lfw.org>:
>
> > __get__(index, ...) # I want an ITEM.
> > __getslice__(slice-object, ...) # I want a SLICE.
>
> I like this (although it would be safer if the new-style
> __getslice__ had a new name as well).
>
> > This would require detection of whether any of the components
> > of a multidimensional (i.e. tuple) index were slices
>
> Doesn't the parser know this already?
Yes.
> By the way, if you're going to make a clear separation between items
> and slices, then either *none* or *all* of the members of a
> multidimensional index should be slices, and mixing them should
> be an error!
Huh? The way I understand this, mixing indices and slices is used all
the time to reduce the dimensionality of an array. E.g. if A is a
2-dimensional array, A[0] is a 1-dim vector, and so are A[0, 1:-1] and
A[:-1, 1].
--Guido van Rossum (home page: http://www.pythonlabs.com/~guido/)