Getting a slice is O(i_2 - i_1). This is because Python's internal representation of a list is an array, so you can start at i_1 and iterate to i_2.

For more information, see the Python Time Complexity wiki entry

You can also look at the implementation in the CPython source if you want to.

Answer from Sam Mussmann on Stack Overflow
๐ŸŒ
FavTutor
favtutor.com โ€บ blogs โ€บ python-list-slicing
Python List Slicing (with Examples)
September 23, 2024 - List slicing in Python has a time complexity of O(k), where k is the number of elements in the slice.
๐ŸŒ
Coding Blocks
discuss.codingblocks.com โ€บ t โ€บ time-complexity-of-python-slice-operation โ€บ 99497
Time complexity of python slice operation - ๐Ÿ’ก-string-window - Coding Blocks Discussion Forum
August 1, 2020 - what is the time complexity of slicing in python. Example: lis[2:] I wrote a program in leetcode with lis slicing and without lis slicing and still got the same time result.
๐ŸŒ
CodeRivers
coderivers.org โ€บ blog โ€บ list-slicing-time-complexity-python
Understanding List Slicing Time Complexity in Python - CodeRivers
February 22, 2026 - The basic syntax is list[start... between each element in the slice. The time complexity of basic list slicing list[start:stop] (when step is 1) is O(k), where k is the number of elements in the resulting slice....
๐ŸŒ
Leyaa
leyaa.ai โ€บ codefly โ€บ learn โ€บ python โ€บ part-2 โ€บ python-list-indexing-and-slicing โ€บ complexity
List indexing and slicing in Python Time Complexity - Big O Analysis | Leyaa.ai
Getting one item by index takes the same time no matter how big the list is. Getting a slice takes time proportional to how many items are in the slice.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-alternate-range-slicing-in-list
Python | Alternate range slicing in list - GeeksforGeeks
April 18, 2023 - The original list : [2, 4, 6, 8, 9, 10, 12, 16, 18, 20, 7, 30] The alternate range sliced list : [8, 9, 10, 20, 7, 30] Time complexity: O(n), where n is the length of the list, as the list comprehension and the enumerate() function both have ...
Find elsewhere
๐ŸŒ
Python
wiki.python.org โ€บ moin โ€บ TimeComplexity
TimeComplexity - Python Wiki
[2] = Popping the intermediate ... 1 moves. The average case for an average value of k is popping the element the middle of the list, which takes O(n/2) = O(n) operations....
๐ŸŒ
Medium
medium.com โ€บ @dfashimpaur โ€บ writing-algorithms-in-python-d852d70759dc
The Power of List Slicing: Writing Better Algorithms In Python
November 10, 2025 - Concatenation (+) of the two slices is also O(N), because it creates a new list ยท This leaves a total time cost for the slicing approach is O(N) with respect to the input size. This is the best possible Time Complexity for a full-array rotation ...
๐ŸŒ
Quora
quora.com โ€บ What-are-the-time-complexity-considerations-of-lists-in-Python
What are the time complexity considerations of lists in Python? - Quora
Answer: In a normal list on average: * Append : O(1) * Extend : O(k) - k is the length of the extension * Index : O(1) * Slice : O(k) * Sort : O(n log n) - n is the length of the list * Len : O(1) * Pop : O(1) - pop from end * Insert : O(n) - n is the length of the list * Del : O(n) - n...
๐ŸŒ
Bradfield CS
bradfieldcs.com โ€บ algos โ€บ analysis โ€บ performance-of-python-types
Performance of Python Types
Slice operations require more thought. To access the slice [a:b] of a list, we must iterate over every element between indices a and b. So, slice access is ... O(n)O(n) since we must reposition each element. Finally (and least intuitively), sorting in Python is
๐ŸŒ
Medium
medium.com โ€บ @ivanmarkeyev โ€บ understanding-python-list-operations-a-big-o-complexity-guide-49be9c00afb4
Understanding Python List Operations: A Big O Complexity Guide | by Ivan Markeev | Medium
June 4, 2023 - When inserting or deleting an element at the beginning or middle of a Python list, the remaining elements must be shifted to accommodate the change. As a result, these operations have a linear time complexity of O(n).
๐ŸŒ
Python Reference
python-reference.readthedocs.io โ€บ en โ€บ latest โ€บ docs โ€บ brackets โ€บ slicing.html
[] (slicing) โ€” Python Reference (The Right Way) 0.1 documentation
>>> +---+---+---+---+ >>> |-4 |-3 |-2 |-1 | <= negative indexes >>> +---+---+---+---+ >>> | A | B | C | D | <= sequence elements >>> +---+---+---+---+ >>> | 0 | 1 | 2 | 3 | <= positive indexes >>> +---+---+---+---+ >>> |<- 0:3:1 ->| <= extent of the slice: "ABCD"[0:3:1]
๐ŸŒ
Esaezgil
esaezgil.com โ€บ home โ€บ python lists pop vs slice performance
Python lists: pop vs slice performance - Enrique Saez
February 22, 2017 - t1 = timeit.Timer('a=50*[\'a\'];a.pop(0)') t2 = timeit.Timer('b=50*[\'b\'];b[1:]') t1.timeit(10000)/10000 6.973965995712205e-07 t2.timeit(10000)/10000 8.281046990305186e-07
๐ŸŒ
Stack Overflow
stackoverflow.com โ€บ questions โ€บ 75424380 โ€บ time-and-space-complexity-of-python-list-slicing-inside-recursive-calls
algorithm - Time and Space Complexity of Python list-slicing inside recursive calls - Stack Overflow
... Yes s[1:] is O(n). So it is O(n + n-1 + n-2 + ... + 2 + 1) = O(nยฒ) ... Save this answer. ... Show activity on this post. Yes, you are right. The space complexity is O(๐‘›ยฒ) because each slice allocates a new string.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-sliced-product-in-list
Python | Sliced Product in List - GeeksforGeeks
April 22, 2023 - Time Complexity : O(K) K - length of sliced list ยท Auxiliary Space : O(1) since we used only one variable to store product. Method5: Using Recursive method: The idea to use the recursive method is based on the following two conditions: If K ...
๐ŸŒ
Pythoncomplexity
pythoncomplexity.com โ€บ builtins โ€บ slice
Slice - Python Big-O: Time & Space Complexity
# Creating slice objects is cheap - O(1) slices = [slice(i, i+10) for i in range(100)] # O(100) # Applying slices is costly - depends on slice size lst = list(range(1000)) # Creating all results - O(100 * 10) = O(1000) results = [lst[s] for s in slices] # More efficient: use indices() and iterate results = [] for s in slices: start, stop, step = s.indices(len(lst)) results.append(lst[start:stop:step]) # Same complexity but clearer