On May 14, 2020, at 03:01, Steven D'Aprano steve@pearwood.info wrote:
On Mon, May 11, 2020 at 10:41:06AM -0700, Andrew Barnert via Python-ideas wrote:
I think in general people will expect that a slice view on a sequence acts like “some kind of sequence”, not like the same kind they’re viewing—again, they won’t be surprised if you can’t insert into a slice of a list.
o_O
For nearly 30 years, We've been able to insert into a slice of a list. I'm going to be *really* surprise if that stops working
Which is exactly why Christopher said from the start of this thread, and everyone else has agreed at every step of the way, that we can’t change the default behavior of slicing, we have to instead add some new way to specifically ask for something different.
Well, not _jusr_ this. There’s also the fact that for 30 years people have been using [:] to mean copy, and the fact that for 30 years people have taken small slices of giant lists and then expected the giant lists to get collected, and so on. But any one of these is enough reason on its own that copy-slicing must remain the default, behavior you get from lst[10:20]. Not only that, but whatever gives you view-slicing must look sufficiently different that you notice the difference—and ideally that gives you something you can look up if you don’t know what it means. I think lst.view[10:20] fits that bill.