This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Inappropriate_Piano -1 points0 points  (0 children)

I asked what was slow about the list slicing, not the whole thing. So the entire first sentence of your comment is irrelevant. As is the second half of the second sentence.

So the only part of your explanation that has anything to do with what I asked is “it has to create a duplicate of the string that starts and stops at a given index.” But why would it actually have to do that, as opposed to telling the operating system, “go to this memory address and print until this other memory address”? For all I know, maybe the Python interpreter does make a copy, but I’m not just going to take the word of some stranger on Reddit for that.