To clear a list in Python, call my_list.clear(). It removes every item from the list in place, so the list object itself survives and is simply empty.
The other options, del my_list[:] and my_list = [], look similar but behave differently when another variable points at the same list.
In this article, I’ll show you each way to empty a list, when it matters which one you pick, and how they compare. I ran every snippet on Python 3.12.5.
The sample list we’ll clear
Every example uses a small shopping cart, plus a second name for the same list:
cart = ["laptop stand", "USB-C hub", "desk lamp"]
checkout = cart # a second name for the SAME list
cartholds three itemscheckoutis not a copy; it points at the very same list
That shared reference is the whole story. If lists being shared by name is new to you, see mutable vs immutable in Python first, or creating an empty list to start from scratch.
Method 1: Clear a list with list.clear() (Recommended)
Here’s the code, using the cart and checkout names from above:
cart = ["laptop stand", "USB-C hub", "desk lamp"]
checkout = cart # a second name for the SAME list
cart.clear()
print(cart)
print(checkout)
print(cart is checkout)
Output:
[]
[]
True
Both names print an empty list, and cart is checkout stays True.

How does this code work?
clear() deletes every item from the existing list object. It doesn’t create anything new and returns None.
Because checkout points at that same object, it sees the empty list too. This is the behavior you want when other code holds a reference, such as a list that you also pop from elsewhere.
Method 2: Clear a list with del and slice assignment
Before Python 3.3 there was no clear(), so people wrote del my_list[:]. It still works.
Let me show you both forms:
cart = ["laptop stand", "USB-C hub", "desk lamp"]
checkout = cart # a second name for the SAME list
del cart[:]
print(cart, checkout)
cart.extend(["monitor", "webcam"])
cart[:] = [] # slice assignment does the same job
print(cart, checkout)
Output:
[] []
[] []

How does this code work?
[:] selects every position in the list. del removes that whole range, and the assignment cart[:] = [] replaces the range with nothing.
Both edit the list in place, so checkout is emptied too. I prefer clear(), but you’ll see these forms in older code.
Why doesn’t my_list = [] clear the other variable?
This is the gotcha. Writing cart = [] doesn’t empty anything. It makes a new, empty list and points the name cart at it.
cart = ["laptop stand", "USB-C hub", "desk lamp"]
checkout = cart # a second name for the SAME list
cart = [] # a brand-new empty list
print(cart)
print(checkout) # the old list is untouched
print(cart is checkout)
Output:
[]
['laptop stand', 'USB-C hub', 'desk lamp']
False

How does this code work?
The old list still exists because checkout refers to it. Only the name cart moved, which is why cart is checkout is now False.
The same thing bites inside functions, where reassigning a parameter only changes the local name:
def reset_wrong(items):
items = [] # rebinds the local name only
def reset_right(items):
items.clear() # empties the caller's list
cart = ["laptop stand", "USB-C hub", "desk lamp"]
reset_wrong(cart)
print("after reset_wrong:", cart)
reset_right(cart)
print("after reset_right:", cart)
Output:
after reset_wrong: ['laptop stand', 'USB-C hub', 'desk lamp']
after reset_right: []

So use clear() when the function should empty the caller’s list. Reassigning is fine when nobody else holds the list, as in a fresh empty list you later check.
Picking the right way to clear a list
| Approach | Empties other references? | Use it when |
|---|---|---|
my_list.clear() | Yes | Almost always; clearest option |
del my_list[:] | Yes | Older code, or Python 2 compatibility |
my_list = [] | No | Nobody else refers to the old list |
while my_list: my_list.pop() | Yes | You need each removed item |
If you only want to drop some items, not all of them, see removing elements from a list in Python.
Things to Keep in Mind When Clearing a List
my_list = []doesn’t affect other names pointing at the old list. Useclear()if they should see an empty list.clear()returnsNone. Writingcart = cart.clear()turns your list intoNone.- Clearing can’t be undone, so copy first with
cart.copy()if you need the data.
Working with lists comes up constantly, so these are worth a look too:
- Remove duplicates from a list in Python
- Sort a list of lists in Python
- Find the size of a list in Python
Frequently asked questions
How do I clear a list in Python?
Call my_list.clear(). It empties the list in place and returns None.
What is the difference between clear() and my_list = []?
clear() empties the existing list, so every variable pointing at it sees an empty list. my_list = [] only points that one name at a new list.
Does del my_list[:] do the same as clear()?
Yes. Both remove every item in place. clear() is newer and easier to read.
How do I clear a list but keep a copy?
Copy it first with backup = my_list.copy(), then call my_list.clear(). The backup stays full.
Why does my function not empty the list I pass in?
Because items = [] rebinds the local name only. Use items.clear() inside the function.
Where is list.clear() documented?
See the list methods in the Python tutorial.

Bijay Kumar is a 13-time Microsoft MVP with more than 18 years in software development, and the founder of Python Guides and TSinfo Technologies. He started out building .NET and SharePoint solutions at HP, TCS and KPIT before moving into Python, machine learning and AI, and he also builds web apps with TypeScript and React. He writes the tutorials here himself, and every example is run before publishing so you see the real output. More about Bijay · Microsoft MVP profile · LinkedIn