Jeff Shannon wrote:
So, what problem is it, exactly, that you think you'd solve by making tuple slices a view rather than a copy?
I think views are good for 1) saving memory 2) saving time (as you don't have to copy the elements into the new tuple)
And they are worth it. However, (as in other cases with slicing), it is very easy and fast to create a view for a slice with the default step '1', while it's a PITA and totally not worth it to create a view for a slice with non default step. I think it would be good to:
if slice_step == 1 create_view else create_new_tuple
Actually, i think that slices with step, is a bad feature in general and i think I will write a PEP to suggest their removal in python3k.
Gerald
-- http://mail.python.org/mailman/listinfo/python-list