Terry J. Reedy <tjre...@udel.edu> added the comment:

I happen to prefer del myself, but I agree that the two mutable sequence 
classes should behave the same. The manual 4.6.4 says

s[i:j:k] = t the elements of s[i:j:k] are replaced by those of t (1) 
1. t must have the same length as the slice it is replacing.

So the list behavior is not a bug. Extending its behavior is a feature request 
that could only happen in the 'next' release, now 3.3.

It is not usually considered a bug for something to do something beyond what is 
promised; in any case, you are *not* requesting that bytearrays be restricted 
as lists are. But that could be the fix to remove the 'bug' of inconsistency.  
That also could not happen until a next release.

Since deletion of contiguous slices works and since deletion of extended slices 
can work and since I found the restriction slightly surprising, I am in favor 
of extending list behavior unless there is some internal reason why it cannot 
be.

The rationale for the restriction is that replacing a contiguous slice with a 
different number of items makes sense but replacing non-contiguous items with a 
different number does not -- except in the special case where the number is 0. 
So what you are really asking is that the footnote be changed to

1. t must have the same length as the slice it is replacing or be empty

That is the current behavior of bytearrays.

----------
nosy: +terry.reedy
stage:  -> test needed
type: behavior -> feature request
versions: +Python 3.3 -Python 3.1

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue12606>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to