You can find a short collection of useful list functions here.

list.pop(index)

>>> l = ['a', 'b', 'c', 'd']
>>> l.pop(0)
'a'
>>> l
['b', 'c', 'd']
>>> 

del list[index]

>>> l = ['a', 'b', 'c', 'd']
>>> del l[0]
>>> l
['b', 'c', 'd']
>>> 

These both modify your original list.

Others have suggested using slicing:

  • Copies the list
  • Can return a subset

Also, if you are performing many pop(0), you should look at collections.deque

from collections import deque
>>> l = deque(['a', 'b', 'c', 'd'])
>>> l.popleft()
'a'
>>> l
deque(['b', 'c', 'd'])
  • Provides higher performance popping from left end of the list
Answer from kevpie on Stack Overflow
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ ref_list_pop.asp
Python List pop() Method
Python Examples Python Compiler ... Interview Q&A Python Bootcamp Python Training ... The pop() method removes the element at the specified position....
Discussions

Is shifting required to pop the front of a list in Python? - Stack Overflow
One could imagine alternative implementations, where popping the front of the list would be cheap (e.g. deque-style). I think we can trust the Python docs on this one, and assume that this is not how the built-in list class is implemented. More on stackoverflow.com
๐ŸŒ stackoverflow.com
something's wrong with pop() function
The issue is that you're iterating over the list at the same time as you're removing items from it. This confuses Python & that's why it's skipping items in the loop. One way to solve this is to make a copy of the list before you loop over it. For example by using for x in list[:]:. More on reddit.com
๐ŸŒ r/learnpython
14
0
June 17, 2023
I was surprised at how slow list.pop() is! And list.remove() is even many times slower
This is simply how lists work, nothing surprising here. Removing the first element requires moving all the elements after it one step to the left to fill that gap, which makes this operation run in linear time. It means that clearing the list this way is O(n2), so it unsurprisingly takes a long time, as bubble sorting the (shuffled) list could even be faster. This is why we think of alternatives when solving problems, such as using collections.deque, reversing the list (O(n) instead of O(n2)) or just using pop() from the end if it works. More on reddit.com
๐ŸŒ r/learnpython
38
57
August 22, 2021
Why do we use pop(0) instead of pop()?
Evgeny Panov is having issues with: Why do we take the elements from the start of the list ( More on teamtreehouse.com
๐ŸŒ teamtreehouse.com
1
October 7, 2016
๐ŸŒ
Seneca-ictoer
seneca-ictoer.github.io โ€บ push_front and pop_front
push_front and pop_front | Data Structures and Algorithms
def push_front(self, data): nn = self.Node(data, self.front) if self.front is None: self.back = nn else: self.front.prev= nn self.front = nn ยท The pop_front() function removes the first node from the linked list.
๐ŸŒ
freeCodeCamp
freecodecamp.org โ€บ news โ€บ python-pop-how-to-pop-from-a-list-or-an-array-in-python
Python .pop() โ€“ How to Pop from a List or an Array in Python
March 1, 2022 - Besides just removing the item, pop() also returns it. This is helpful if you want to save and store that item in a variable for later use. #list of programming languages programming_languages = ["Python", "Java", "JavaScript"] #print initial list print(programming_languages) #remove last item, which is "JavaScript", and store it in a variable front_end_language = programming_languages.pop() #print list again print(programming_languages) #print the item that was removed print(front_end_language) #output #['Python', 'Java', 'JavaScript'] #['Python', 'Java'] #JavaScript
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-removing-first-element-of-list
Remove first element from list in Python - GeeksforGeeks
Explanation: a.pop(0) removes and returns the first element of the list, shifting the remaining elements left.
Published ย  July 11, 2025
Find elsewhere
๐ŸŒ
FavTutor
favtutor.com โ€บ blogs โ€บ remove-first-element-from-list-python
Remove First Element from List in Python (with code)
August 24, 2023 - In this method, we convert the list into the deque and then use the popleft() method which helps to return the first element from the front of the list. Remember that to implement this method, you have to import the Python deque at the beginning ...
๐ŸŒ
Programiz
programiz.com โ€บ python-programming โ€บ methods โ€บ list โ€บ pop
Python List pop()
If you need to pop the 4th element, you need to pass 3 to the pop() method. # programming languages list languages = ['Python', 'Java', 'C++', 'Ruby', 'C'] # remove and return the last item print('When index is not passed:')
๐ŸŒ
Reddit
reddit.com โ€บ r/learnpython โ€บ something's wrong with pop() function
r/learnpython on Reddit: something's wrong with pop() function
June 17, 2023 -

i'm trying to transfer elements from a list to another, taking them out of the first one, and to do so I did something like the following:

for x in list1:

list2.append(list1.pop(list1.index(x)))

print(list2)

I've tried doing it other ways too, substituting the append function etc., but for some reason I've found that whenever I use pop() the only elements that are actually used are the ones with odd indexes.

for example the output of the code above was:

input: list1 = [1, 7, 82, 4, 0] list2 = []

output: [1, 82, 0]

the weird thing is that as I was losing my mind over this I also tested this code to see if it was as absurd as it seemed:

for x in list:
print(x)
list.pop(list.index(x))

and the output was still only the odd indexes of the list. I'm sorry but by the very definition of a for cycle this makes absolutely 0 sense.

๐ŸŒ
Medium
medium.com โ€บ @shuangzizuobh2 โ€บ how-well-do-you-code-python-9bec36bbc322
How slow is python list.pop(0) ?. An empirical study on python list.popโ€ฆ | by Hj | Medium
September 27, 2023 - Queue is only an abstract data type, and different languages have their own implements. In Python, the appropriate FIFO queue is deque, which provides append and popleft functions to push an element in the end and pop the oldest element from the front, respectively.
๐ŸŒ
Educative
educative.io โ€บ answers โ€บ how-to-remove-the-first-element-from-an-array-in-python
How to remove the first element from an array in Python
The popleft() operation is used to remove the element from the front of the list after converting the list to a deque, which is a less usual method for carrying out this specific task.
๐ŸŒ
Finxter
blog.finxter.com โ€บ home โ€บ learn python blog โ€บ python list pop()
Python List pop() โ€“ Be on the Right Side of Change
June 19, 2021 - This tutorial shows you everything ... programming language. Definition and Usage: The list.pop() method removes and returns the last element from an existing list....
๐ŸŒ
Analytics Vidhya
analyticsvidhya.com โ€บ home โ€บ understanding python pop() method
Understanding Python pop() Method
October 12, 2024 - This built-in function helps you achieve exactly that. It removes an element from a list based on its index and, most importantly, returns the removed element, giving you control over your data structures.
๐ŸŒ
Python Help
pythonhelp.org โ€บ python-lists โ€บ how-to-pop-first-element-in-list-python
How to Pop First Element in List Python
October 2, 2023 - This article will show you how to use the pop() function to remove and retrieve the first item in a list in Python, which can be extremely useful when working with various types of data structures lik ...
๐ŸŒ
Python
docs.python.org โ€บ 3.1 โ€บ tutorial โ€บ datastructures.html
https://docs.python.org/3.1/tutorial/datastructure...
September 4, 2012 - The first argument is the index of the element before which to insert, so a.insert(0, x) inserts at the front of the list, and a.insert(len(a), x) is equivalent to a.append(x). ... Remove the first item from the list whose value is x. It is an error if there is no such item. ... Remove the item at the given position in the list, and return it. If no index is specified, a.pop() removes and returns the last item in the list.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-list-pop-method
Python List pop() Method - GeeksforGeeks
2 days ago - Explanation: a.pop() removes and returns the last element of the list and removed value is stored in val.
๐ŸŒ
DataCamp
datacamp.com โ€บ tutorial โ€บ python-pop
How to Use the Python pop() Method | DataCamp
July 31, 2024 - Learn how to use Python's pop() method to remove elements from lists and dictionaries. Learn to avoid common errors like IndexError and KeyError.
๐ŸŒ
Reddit
reddit.com โ€บ r/learnpython โ€บ i was surprised at how slow list.pop() is! and list.remove() is even many times slower
r/learnpython on Reddit: I was surprised at how slow list.pop() is! And list.remove() is even many times slower
August 22, 2021 -

I know there is a list.clear(), I'm just sharing that I didn't expect that using list.pop() and list.remove() specifically could slow down the program that much.

li = list(range(500000))

Creating a list is quick.

So we are going to test out pop/remove specific values. For the purpose of this "benchmark", we are going to remove all elements from the list:

while (li):
    li.pop(0)

It took 74.735 seconds to pop all the elements! It's ridiculously long.
I KNOW it would have been much faster if I even had used li.pop() without the index or maybe used filter function, list comprehension with conditional or whatever
But that's what I'm trying to show, how slow it is to remove certain list items specifically using pop and remove methods.

And li.remove(), which always requires a specified value to remove, is even worse than pop!

 for num in li:
    li.remove(num)

This one took me 303.268 seconds to complete. How crazy it is.

I've been having fun with abstract data structures. Implemented linked lists and a queues running on linked lists.

And for the sake of interest, I decided to compare the performance of the queue based on the linked list and the usual python list. And I was surprised. When my linked list Queue dequeued 500.000 elements in 0.5 seconds, while python list Queue was doing it in 75 seconds.

Top answer
1 of 5
46
This is simply how lists work, nothing surprising here. Removing the first element requires moving all the elements after it one step to the left to fill that gap, which makes this operation run in linear time. It means that clearing the list this way is O(n2), so it unsurprisingly takes a long time, as bubble sorting the (shuffled) list could even be faster. This is why we think of alternatives when solving problems, such as using collections.deque, reversing the list (O(n) instead of O(n2)) or just using pop() from the end if it works.
2 of 5
13
Just thought I'd mention that, on top of being the slowest option presented here, for num in li: li.remove(num) is also broken; it skips every other value in the list and the result is essentially only half of the original list, not an empty one. The reason for this already came up in the other answers, as the values shift in the list when you remove one, but the loop itself doesn't take this into account. You can think of the loop as if it had a hidden index variable it updates on every iteration, and when the values are shifted what was previously going to be the next value after deletion is now where the deleted one was, the loop index goes up by one, and the next index to be removed is the one next to the current one. EDIT: It's easier to understand visually, I guess. idx | 0 | 1 | 2 | 3 | 4 | val | 1 | 2 | 3 | 4 | 5 Loop index: 0 Removing item at index 0 idx | 0 | 1 | 2 | 3 | 4 | val | 2 | 3 | 4 | 5 | ... Loop index: 1 Removing item at index 1 idx | 0 | 1 | 2 | 3 | 4 | val | 2 | 4 | 5 | ... | ... Loop index: 2 Removing item at index 2 Idx | 0 | 1 | 2 | 3 | 4 | val | 2 | 4 | ... | ... | ... EDIT #2: If you needed to empty a list in a real project, the best options would be to either reassign an empty list, or use list.clear which is way faster than using list.pop in a loop.