๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ ref_list_pop.asp
Python List pop() Method
Remove List Duplicates Reverse ... Interview Q&A Python Bootcamp Python Training ... The pop() method removes the element at the specified position....
๐ŸŒ
Reddit
reddit.com โ€บ r/learnpython โ€บ list.pop and list.pop()
r/learnpython on Reddit: list.pop and list.pop()
June 27, 2024 -

This feels like one of those python weird things. I am interested in explanations.

If I have a list=[1,2,3,4] and I do list.pop() the result is list=[1,2,3].

Perfect, just what I wanted.

However, if I am not careful and instead do list.pop--note there are no parentheses this time--I get no syntax error or warning and nothing happens, leading me to a strange debug session.

In the repl, if I do l.pop it just identifies it as a built-in method of list object at 0xwhatever. That's useful, but why is there not at least a runtime warning when I make this mistake in my code?

๐ŸŒ
Programiz
programiz.com โ€บ python-programming โ€บ methods โ€บ list โ€บ pop
Python List pop()
The pop() method returns the item present at the given index. This item is also removed from the list. # programming languages list languages = ['Python', 'Java', 'C++', 'French', 'C']
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-list-pop-method
Python List pop() Method - GeeksforGeeks
2 days ago - DSA Python ยท Data Science ยท NumPy ยท Pandas ยท Practice ยท Django ยท Flask ยท Last Updated : 17 Jul, 2026 ยท pop() method removes an element from a list and returns the removed value.
๐ŸŒ
Mimo
mimo.org โ€บ glossary โ€บ python โ€บ pop()
Python Pop Method: Essential Data Manipulation techniques
In Python, pop() is a list method that removes and returns an element of a list. With an argument, pop() removes and returns the item at the specified index (starting from 0).
๐ŸŒ
Codecademy
codecademy.com โ€บ docs โ€บ python โ€บ lists โ€บ .pop()
Python | Lists | .pop() | Codecademy
May 26, 2025 - The .pop() method in Python removes an element from a list at a specified index and returns that element. The .pop() method directly modifies the original list by removing the element at the given position.
๐ŸŒ
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.
๐ŸŒ
Python documentation
docs.python.org โ€บ 3 โ€บ tutorial โ€บ datastructures.html
5. Data Structures โ€” Python 3.14.6 documentation
The list methods make it very easy ... add an item to the top of the stack, use append(). To retrieve an item from the top of the stack, use pop() without an explicit index....
๐ŸŒ
Tutorialspoint
tutorialspoint.com โ€บ python โ€บ list_pop.htm
Python List pop() Method
The Python List pop() method removes and returns the last object from the list, by default. However, the method also accepts an optional index argument and the element at the index is removed from the list.
Find elsewhere
๐ŸŒ
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
๐ŸŒ
w3resource
w3resource.com โ€บ python โ€บ list โ€บ list_pop.php
Python List pop() Method
April 14, 2026 - The pop() method removes and returns an item from a list at a specified position. 2. What happens if no index is specified in Python list?
๐ŸŒ
How to Use Linux
howtouselinux.com โ€บ home โ€บ understanding python list pop method
Understanding Python List Pop Method - howtouselinux
October 9, 2025 - The Python list pop method is a built-in method that removes the item at the given index from the list. It returns the removed item. The index is optional. If the index is not given, then the last element is popped out and removed.If the index passed to the method is not in range, it [โ€ฆ]
๐ŸŒ
Python Guides
pythonguides.com โ€บ python-list-pop-method
Python pop() List Method
October 13, 2025 - This is one of the most common ways I use pop() when managing dynamic lists in automation scripts. Sometimes, you may want to remove an item from a specific position in the list rather than the last one. Pythonโ€™s pop() method allows you to specify the index of the element you want to remove.
๐ŸŒ
DigitalOcean
digitalocean.com โ€บ community โ€บ tutorials โ€บ pop-python
How to Use `.pop()` in Python Lists and Dictionaries | DigitalOcean
July 24, 2025 - Pythonโ€™s .pop() method is a powerful and flexible built-in function that allows you to remove and return elements from both lists and dictionaries. This method is especially useful in scenarios where you need to both extract and delete items in a single, efficient operation.
๐ŸŒ
Hyperskill
hyperskill.org โ€บ university โ€บ python โ€บ pop-in-python
Pop() in Python
October 14, 2025 - The Python pop() function deletes an element from a list at an index or if no index is specified, the last item. It comes in handy for removing items, from a list without changing the order of elements.
๐ŸŒ
AskPython
askpython.com โ€บ python โ€บ list โ€บ python-list-pop
How to Use The Python List pop() Method - AskPython
August 6, 2022 - This is a method of the List object type, so every list object will have this method. ... This is the default invocation, and will simply pop the last item from the list.
Top answer
1 of 3
18

Are your lists large? If so, use ifilter from itertools to filter out elements that you don't want lazily (with no up front cost).

Lists not so large? Just use a list comprehension:

 newlist = [x for x in oldlist if x not in ['a', 'c'] ]

This will create a new copy of the list. This is not generally an issue for efficiency unless you really care about memory consumption.

As a happy medium of syntax convenience and laziness ( = efficiency for large lists), you can construct a generator rather than a list by using ( ) instead of [ ]:

interestingelts = (x for x in oldlist if x not in ['a', 'c'])

After this, you can iterate over interestingelts, but you can't index into it:

 for y in interestingelts:    # ok
    print y

 print interestingelts[0]     # not ok: generator allows sequential access only
2 of 3
15

You want a list comprehension:

L = [c for c in L if c not in ['a', 'c']]

Or, if you really don't want to create a copy, go backwards:

for i in reversed(range(len(L))):
    if L[i] in ['a', 'c']:
        L.pop(i)    # del L[i] is more efficient

Thanks to ncoghlan for reversed() & phooji for del L[i] suggestions. (I decided to leave it as L.pop(i), since that's how the question was initially formulated.)

Also, as J.S. Sebastian correctly points out, going backwards is space efficient but time inefficient; most of the time a list comprehension or generator (L = (...) instead of L = [...]) is best.

Edit:

Ok, so since people seem to want something less ridiculously slow than the reversed method above (I can't imagine why... :) here's an order-preserving, in-place filter that should differ in speed from a list comprehension only by a constant. (This is akin to what I'd do if I wanted to filter a string in c.)

write_i = 0
for read_i in range(len(L)):
    L[write_i] = L[read_i]
    if L[read_i] not in ['a', 'c']:
         write_i += 1

del L[write_i:]
print L
# output: ['b', 'd']
๐ŸŒ
GoLinuxCloud
golinuxcloud.com โ€บ home โ€บ programming โ€บ python list pop() method: remove and return items
Python List pop() Method: pop by Index, Last Item, First Item, and Errors (2026)
January 9, 2024 - Tested on: Python 3.13.3; kernel 6.14.0-37-generic. list.pop([i]) removes the item at index i, returns it, and mutates the same list object. If you omit i, Python uses -1 (the last element). The list becomes shorter by one.
๐ŸŒ
Python Pool
pythonpool.com โ€บ home โ€บ blog โ€บ 5 techniques to use list pop() method in python
5 Techniques to Use List pop() Method in Python - Python Pool
January 3, 2024 - List pop() is the inbuilt function in python through which we can pop out the last element from the list if no parameter is passed
๐ŸŒ
Tutorial Gateway
tutorialgateway.org โ€บ python-pop-list-function
Python list pop function
April 13, 2026 - The Python list pop() function removes an item from the existing list at a user-specified index and returns the deleted item as the output. By default, it removes the last item in a list.