Python list.copy() Method

Beginner
6 min read
Updated: Nov 2026
3 examples
list method

Definition

copy() returns a new list with the same items in the same order. Adding, removing, or reordering items in one list never affects the other.

It is a shallow copy: the items themselves are not duplicated. If an item is a list or dict, both lists point to that same inner object, so changing it through one is visible through the other. For fully independent nested data, use copy.deepcopy() after import copy.

list.copy() is an instance method of the built-in list type: call it on a list with dot notation, such as guests.copy(...). No import is needed.

Syntax

Call it with no arguments and keep the returned list.

python
new_list = lst.copy()
CallWhat it does
[1, 2, 3].copy()Returns [1, 2, 3], a new list object.
[[1], [2]].copy()Returns [[1], [2]]; the inner lists are shared, not copied.
lst[:]Makes the same shallow copy as lst.copy(), and so does list(lst).

Plain assignment, b = a, makes no copy at all: it gives the same list a second name. copy() was added in Python 3.3, so older code tends to use a[:].

Method signatures
python
list.copy()
# returns: a new list with the same items (shallow copy)

Parameters

copy() takes no parameters.

Return Value

Return ValueDescription
listA new list, equal to the original (== is True) but a different object (is is False). Its items are the same objects as the original's.

Python Examples

Example 1 — Draft Changes to a Party Guest List

alias = guests shares one list, while guests.copy() gives a separate draft to edit.

python
guests = ["Ana", "Ben", "Chloe"]
alias = guests
draft = guests.copy()

alias.append("Dev")
draft.remove("Ben")

print(guests)
print(draft)
print(alias is guests, draft is guests, draft == guests)

How It Works

  1. Assignment is not copying. alias is just a second name for guests, so appending Dev through it changes the real list.
  2. A real copy. draft is a new list; removing Ben from it leaves guests alone.
  3. Identity and equality. alias is guests is True, the draft is a different object, and after the edits their contents differ as well.

Example 2 — Copy a Game Board Made of Rows

A shallow copy shares the row lists, so editing a cell changes both boards. A deep copy does not.

python
import copy

board = [[0, 0, 0], [0, 0, 0]]
shallow = board.copy()
deep = copy.deepcopy(board)

shallow[0][1] = 5
shallow.append([9, 9, 9])

print(board)
print(shallow)
print(deep)
print(shallow[0] is board[0], deep[0] is board[0])

How It Works

  1. Shared rows. shallow[0] is the very same row list as board[0], so setting a cell to 5 shows up on both boards.
  2. Outer list is separate. Appending a third row affects only shallow; board still has two rows.
  3. Deep copy is independent. copy.deepcopy() copied every row too, so deep is still all zeros.
  4. Identity proof. The shallow copy's first row is the original row object, while the deep copy's is not.

Example 3 — Drop Expired Coupon Codes Safely

Loop over a copy while removing from the original, then compare the three ways to make a shallow copy.

python
coupons = ["SAVE10", "OLD5", "OLD20", "FREESHIP"]

for code in coupons.copy():
    if code.startswith("OLD"):
        coupons.remove(code)
print(coupons)

a = coupons.copy()
b = coupons[:]
c = list(coupons)
print(a == b == c)
print(a is coupons, b is coupons, c is coupons)

How It Works

  1. Iterate a snapshot. The loop walks over coupons.copy(), so removing from coupons cannot shift the items the loop still has to visit.
  2. Both expired codes go. OLD5 and OLD20 sit next to each other, and both are removed; looping over the original would have skipped OLD20.
  3. Three spellings, one result. copy(), the full slice [:], and list() all produce equal new lists.
  4. All new objects. None of the three copies is the original list.

Frequently Asked Questions

No. It makes a shallow copy: a new list whose items are the same objects. Nested lists and dicts are shared with the original.
b = a creates a second name for the same list, so changes show through both names. b = a.copy() creates a separate list.
Yes. lst[:], list(lst), and lst.copy() all return a new shallow copy with the same items in the same order.
Use copy.deepcopy(grid) for full independence. If each row only holds numbers or strings, [row.copy() for row in grid] is enough.
No. Copying takes time proportional to the length because every reference is copied, but the item objects are shared, not duplicated.

Next: list.count()

Count how many items are equal to a value.

count() →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

12 people found this page helpful