For an ordinary Python list, use new_list = old_list.copy() to create a separate outer list. It is a shallow copy: if the list contains nested mutable objects, those objects are still shared. Use copy.deepcopy() only when nested objects also need to be independent.
What is the simplest way to copy a Python list?
Call .copy() on the list:
original = [1, 2, 3]
new_list = original.copy()
new_list.append(4)
print(original) # [1, 2, 3]
print(new_list) # [1, 2, 3, 4]
This creates a new outer list, so adding, removing, or replacing top-level items in one list does not change the other. The items themselves are not recursively copied. Python’s copy module documentation describes a shallow copy as a new compound object populated with references to the original’s contents.
Does assignment with = copy a list?
No. Assignment binds another name to the same list:
original = [1, 2, 3]
alias = original
alias.append(4)
print(original) # [1, 2, 3, 4]
Because original and alias refer to one list, changes made through either name are visible through the other. Use assignment when you want another name for the same object; use a copy method when you need a separate outer list.
#1 Best Overall
Which list-copy method should you use?
For ordinary lists, .copy(), a full slice, and list() each create a shallow copy. Their main difference is expression and context, not whether nested objects are copied.
| Expression | New outer list? | Nested mutable objects copied? | Typical use |
|---|---|---|---|
b = a |
No | No | Give the same list another name |
a.copy() |
Yes | No | Explicit, readable shallow copy |
a[:] |
Yes | No | Copy all items with a slice |
list(a) |
Yes | No | Build a list from an iterable |
copy.deepcopy(a) |
Yes | Recursively, subject to object behavior | Make nested data independent where needed |
For a list subclass, type preservation may matter. The official copy documentation cautions that list methods and slicing may return the base list type; copy.copy() normally preserves the object’s type. Check the behavior of your particular subclass if its type or custom behavior must be retained.
Rank #2
Why can a shallow copy still change the original?
A shallow copy duplicates only the outer container. If an item is itself a mutable list or dictionary, both outer lists still refer to that same nested object.
original = [1, [2, 3]]
shallow = original.copy()
shallow[1].append(4)
print(original) # [1, [2, 3, 4]]
print(shallow) # [1, [2, 3, 4]]
The top-level lists are distinct, but their second items are the same nested list. Mutating that nested list through either outer list is visible through both. This also applies to other mutable values, such as dictionaries contained in a list.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →How do you copy nested lists independently?
Use copy.deepcopy() when nested mutable objects need to be independent too:
import copy
original = [1, [2, 3]]
deep = copy.deepcopy(original)
deep[1].append(4)
print(original) # [1, [2, 3]]
print(deep) # [1, [2, 3, 4]]
Deep copying recursively copies compound objects, but it is not a promise that every value becomes a separate duplicate. The copy module uses a memo to handle objects it has already copied, and classes can customize copying. Some types—including files, sockets, frames, and modules—are not copied; functions and classes are returned unchanged. Deep copying can also duplicate data that your program intended to keep shared, so choose it based on the independence your code requires rather than using it automatically.
How do you copy only part of a list?
Use a bounded slice. The start index is included and the stop index is excluded:
original = ["a", "b", "c", "d", "e"]
part = original[1:4]
print(part) # ['b', 'c', 'd']
The slice creates a new outer list containing the selected items. If any selected item is a mutable nested object, that object remains shared, just as it does in any other shallow copy.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteBest Value
Is copy.replace() another way to copy a list?
No. Python 3.13 added copy.replace() for supported named tuples, dataclasses, and classes that implement __replace__(). It is a limited replacement operation, not a general list-copy method; use .copy(), a slice, list(), or copy.deepcopy() for the list-copy cases above.
Quick Recap
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.

