This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients py.user, terry.reedy
Date 2011-07-21.23:18:44
SpamBayes Score 1.110223e-16
Marked as misclassified No
Message-id <1311290324.98.0.843811681376.issue12606@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2011-07-21 23:18:45terry.reedysetrecipients: + terry.reedy, py.user
2011-07-21 23:18:44terry.reedysetmessageid: <1311290324.98.0.843811681376.issue12606@psf.upfronthosting.co.za>
2011-07-21 23:18:44terry.reedylinkissue12606 messages
2011-07-21 23:18:44terry.reedycreate