Slicing and performance

It might be that I don't understand slicing that well. I want to add one list from a particular index to another list. I was wondering, because I read that if you slice a list that you make a (deep)copy of it, which method is faster:

method 1

new_lst += old_lst[i:]

method 2

while i < len(old_lst):
    new_list.append(old_lst[i])
    i += 1


from Recent Questions - Stack Overflow https://ift.tt/3bNm0cx
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Today Walkin 14th-Sept

Hibernate Search - Elasticsearch with JSON manipulation

Spring Elasticsearch Operations