October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk3 min

How to Remove the First Element from a List in Python: pop(0), del, and Slicing

Learn when to use pop(0), del items[0], or slicing to remove a Python list's first element—and why deque.popleft() is better for repeated queue operations.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use items.pop(0) when you want to remove and keep the first value. Use del items[0] to remove it without returning it, or items = items[1:] when you want a new list without the first item. For repeated first-in, first-out (FIFO) removal, use collections.deque and popleft().

Choose the method that matches what you need

What you need Use What happens
Remove the first item and use its value first = items.pop(0) Mutates items and returns the removed value.
Remove the first item without using its value del items[0] Mutates the existing list; it does not return the removed value.
Create a list without the first item items = items[1:] Creates a new list and rebinds items; other references to the old list remain unchanged.
Repeatedly remove items from the front as a queue collections.deque with popleft() Uses a collection designed for efficient operations at both ends.

Remove and return the first item with pop(0)

Pass index 0 to pop to remove the item at the start of the list and return its value:

As an Amazon Associate I earn from qualifying purchases.

items = [10, 20, 30]
first = items.pop(0)

print(first)  # 10
print(items)  # [20, 30]

This changes the original list. Choose it when the removed value is useful—for example, when processing the next item and keeping the rest for later.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Remove the first item in place with del

Use del items[0] if you want to mutate the list but do not need the removed value:

items = [10, 20, 30]
del items[0]

print(items)  # [20, 30]

del changes the existing list and does not produce the deleted item as a return value.

Create a new list with slicing

The slice items[1:] contains the elements from index 1 through the end. Assigning it back to the same name makes that name refer to a new list:

items = [10, 20, 30]
items = items[1:]

print(items)  # [20, 30]

This does not remove anything from the original list object. If another variable refers to that object, it still sees the original contents:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
items = [10, 20, 30]
alias = items
items = items[1:]

print(items)  # [20, 30]
print(alias)  # [10, 20, 30]

Use slicing when a separate list is what you want, rather than an in-place change.

Handle an empty list deliberately

Both items.pop(0) and del items[0] raise IndexError if the list is empty. A slice is safe on an empty list: items[1:] returns an empty list.

If the list may be empty, check before removing an item or handle the exception according to your program’s needs:

if items:
    first = items.pop(0)
else:
    first = None

Why repeated front removal is slow on a list

Removing an item at the front of a list requires shifting the remaining elements. The Python tutorial explains that popping from the beginning is slow “because all of the other elements have to be shifted by one.” The Python tutorial’s list-as-queue section recommends a deque for queue operations.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The CPython time-complexity reference classifies pop(k) and deleting an item at index k as O(n-k), and deleting a slice starting at index i as O(n-i). These are asymptotic costs, not measured timings; the reference is specifically for CPython and notes that other Python implementations may differ. Slicing also constructs a result list, so it is not a constant-time way to consume queue items.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Use deque.popleft() for a FIFO queue

If your program repeatedly consumes items from the front, use collections.deque:

from collections import deque

queue = deque([10, 20, 30])
first = queue.popleft()

print(first)  # 10
print(queue)  # deque([20, 30])

The Python deque documentation describes appends and pops at either end as approximately O(1), and contrasts them with the memory movement required by list.pop(0). A list remains useful when you need fast random access; indexed access on a deque slows toward the middle.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.