
[Guido]
Second, what should happen to a slice assignment?
[Ping]
My vote is: nothing! (Read on.)
The basic slice form is:
a[i:j] += b
What does this mean? I don't see how it could be any different from:
a[j:j] = b
Apparently you haven't used NumPy arrays (matrices). I haven't either, but I hear they overload + so that A+B is elementwise addition, and you can write A+1 to add 1 to each element of A. Thus, for a NumPy programmer, A += 1 would certainly look like A = A+1, and similar for A += B.
It looks to me like going through various contortions to support augmented assignment to slices is not going to be worth the trouble.
May i suggest
>>> a[i:j] += b SyntaxError: augmented assignment to a slice is not allowed
That's what I thought too until I realized that for NumPy arrays slice+= makes sense. --Guido van Rossum (home page: http://www.pythonlabs.com/~guido/)