<div dir="ltr"><div class="gmail_quote">On Thu, 7 May 2015 at 20:40 Andrew Barnert via Python-ideas <<a href="mailto:python-ideas@python.org">python-ideas@python.org</a>> wrote:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
One question: when you slice a view, do you get a copy, or another view? Because if it's the latter, you can write view slices with view(s)[1:] instead of view(s, 1, None), which seems like a big readability win, but on the other hand it means a view doesn't act just like a normal sequence--e.g., v[:] no longer makes a copy. (NumPy does the latter, of course.)</blockquote><div><br></div><div>Well, in the context of strings it doesn't matter. (or, in some sense, not copying immutable strings is a viable implementation technique for copying them). CPython already knows that:</div><div><br></div><div>>>> x = "foo"</div><div>>>> x is x[:]</div><div>True</div><div><br></div><div>Ed Kellett</div></div></div>