list[-1:] creates a new list. To get the same behavior as list[len(list)-1] , it would have to return an idea of some list , but, as I said, it creates a new temporary list. Then go on to edit the temporary list.
Anyway, you know that you can use list[-1] for the same thing, right?
Magnus hoff
source share