On 10/28/2011 3:21 AM, Steven D'Aprano wrote:
If the slice has too few elements, you've just blown away the entire iterator for no good reason.
If the slice is the right length, but the iterator doesn't next raise StopIteration, you've just thrown away one perfectly good value. Hope it wasn't something important.
You have also over-written values that should be set back to what they were, before the exception is raised, which is why I said the test needs to be done with a temporary array.
-- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list