Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →list.append(value) adds one object to the end of an existing Python list and mutates that list in place. The usual pattern is:
items = [1, 2]
items.append(3)
print(items) # [1, 2, 3]
append() returns None, so do not assign its result back to the list. The current Python 3.14.7 documentation describes the method as list.append(value, /); the slash means the argument is positional-only.
What is a Python list?
A list is an ordered, mutable, indexed sequence. Items keep their order, indexing starts at zero, and the list can grow or shrink. A list may contain objects of different types:
values = [10, "Python", 3.14, True]
Because lists are mutable, methods such as append() change the existing object rather than producing a replacement list. See the list reference and the Python tutorial.
#1 Best Overall
What append() does
The syntax is:
list_name.append(value)
The value is placed after the current last item. The important rule is that one call adds exactly one object, regardless of that object’s type.
colors = ["red", "green"]
colors.append("blue")
# ["red", "green", "blue"]
Python documents the operation as equivalent to:
items[len(items):len(items)] = [value]
It does not inspect an argument and flatten it. A list, tuple, string, dictionary, generator, or custom object is stored as one element.
Examples with different values
Numbers and strings
numbers = [1, 2]
numbers.append(3) # [1, 2, 3]
letters = ["a", "b"]
letters.append("cd") # ["a", "b", "cd"]
The string "cd" remains one element; its characters are not separated.
Lists, tuples, dictionaries, and None
matrix = [[1, 2], [3, 4]]
matrix.append([5, 6])
# [[1, 2], [3, 4], [5, 6]]
items = []
items.append((1, 2))
# [(1, 2)]
records = []
records.append({"id": 1, "name": "Ada"})
# [{"id": 1, "name": "Ada"}]
values = []
values.append(None)
# [None]
Does append() modify the original list?
Yes. Assignment creates another reference to the same list; it does not copy the list.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitchesfirst = [1, 2]
second = first
first.append(3)
print(first) # [1, 2, 3]
print(second) # [1, 2, 3]
If you need a separate list, concatenation creates one:
Rank #2
first = [1, 2]
second = first + [3]
print(first) # [1, 2]
print(second) # [1, 2, 3]
The tutorial explains this mutability and aliasing behavior at docs.python.org.
append() versus extend()
Use append(x) when x should be one element. Use extend(iterable) when each item produced by the iterable should be added separately.
| Code | Result | Meaning |
|---|---|---|
a.append([3, 4]) |
[1, 2, [3, 4]] |
The list argument is one element. |
b.extend([3, 4]) |
[1, 2, 3, 4] |
The iterable’s contents are added individually. |
items = []
items.append("abc")
# ["abc"]
items = []
items.extend("abc")
# ["a", "b", "c"]
This distinction also matters for generators:
def generate_numbers():
yield 1
yield 2
yield 3
items = []
items.extend(generate_numbers())
# [1, 2, 3]
items = []
items.append(generate_numbers())
# []
append() stores the generator object; it does not consume it. The built-in sequence definitions are in the mutable-sequence reference.
append() versus insert(), +, and +=
Choose insert() for a position
items = ["a", "b"]
items.insert(1, "x")
# ["a", "x", "b"]
append() always targets the end. The tutorial notes that items.insert(len(items), value) is equivalent to items.append(value).
items.insert(0, "first")
# inserts at the front
Frequent front insertions are a queue workload; use collections.deque for efficient operations at both ends. See the deque documentation.
Choose + for a new list
original = [1, 2]
combined = original + [3, 4]
# original == [1, 2]
# combined == [1, 2, 3, 4]
Concatenation leaves the operands unchanged, whereas append() mutates its list.
Choose extend() or += for in-place multiple-item addition
items = [1, 2]
items.extend([3, 4])
# [1, 2, 3, 4]
items = [1, 2]
items += [3, 4]
# [1, 2, 3, 4]
Both add the right-hand iterable in place; extend() often makes that intent clearer.
Using append() in loops
Appending is a natural way to accumulate values arriving one at a time:
squares = []
for number in range(5):
squares.append(number * number)
print(squares) # [0, 1, 4, 9, 16]
Conditional accumulation works the same way:
positive = []
for number in [-2, 0, 3, 5]:
if number > 0:
positive.append(number)
# [3, 5]
For a simple mapping or filter, a list comprehension may be clearer:
squares = [number * number for number in range(5)]
Use an ordinary loop when several statements, branches, side effects, or incremental input from a file, socket, iterator, or event source make the procedural form easier to understand. The official examples cover both methods and comprehensions at list methods and list comprehensions.
The return value: why assigning append() is a mistake
Mutating list methods return None:
items = [1, 2]
result = items.append(3)
print(items) # [1, 2, 3]
print(result) # None
Therefore this common statement destroys your list reference:
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →items = items.append(3) # wrong
After it runs, items is None. Call the method as a standalone statement instead. The tutorial discusses these list methods at docs.python.org.
Common errors
- Wrong object:
items = None; items.append(1)raisesAttributeError: 'NoneType' object has no attribute 'append'. Accidental assignment of the method’sNoneresult is a frequent cause. - Missing argument:
items.append()raisesTypeError; one value is required. - Too many arguments:
items.append(1, 2)raisesTypeError. Useextend([1, 2])for two separate elements. - Unexpected nesting:
items.append([1, 2])produces[[1, 2]], not[1, 2]. - Capitalization: Python is case-sensitive.
items.Append(1)raisesAttributeError; the method is lowercase. - Keyword argument: current Python documents the signature as
list.append(value, /). Useitems.append(3), notitems.append(value=3).
Appending while iterating
Appending to the list being traversed changes the sequence underneath its iterator:
items = [1, 2, 3]
for item in items:
items.append(item * 10)
The iterator continues accessing the underlying mutable sequence by index, so this can keep expanding the work instead of processing only the original items. Unless that behavior is deliberate and bounded, build a separate result:
items = [1, 2, 3]
result = []
for item in items:
result.append(item * 10)
print(result) # [10, 20, 30]
See the reference’s discussion of common sequence operations.
Crashes, 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 minuteWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallBest Value
References to mutable objects and nested lists
append() stores a reference to the object; it does not deep-copy a mutable value.
row = []
table = []
table.append(row)
row.append("value")
print(table) # [["value"]]
Repeated-list multiplication repeats references to the same inner list:
row = []
table = [row] * 3
table[0].append(1)
print(table) # [[1], [1], [1]]
Create independent inner lists with a comprehension:
table = [[] for _ in range(3)]
table[0].append(1)
print(table) # [[1], [], []]
The aliasing distinction is documented under common sequence operations.
Performance and choosing a data structure
In CPython, repeated end appends are generally efficient because list storage grows capacity as needed. That is an implementation-oriented observation, not a universal Big-O guarantee for every Python implementation. The language contract specifies the result and mutation, so choose append() because it expresses “add one item at the end,” not because of an assumed implementation-independent complexity promise.
Use this decision guide:
| Goal | Preferred operation |
|---|---|
| Add one object at the end | append(value) |
| Add each item from an iterable | extend(iterable) |
| Add at a chosen position | insert(index, value) |
| Create a new combined list | a + b |
| Extend in place with another iterable | a += b |
| Frequent additions and removals at both ends | collections.deque |
The Bottom Line
Use append() for one object at the end of an existing list, extend() for adding an iterable’s contents, and never assign the result of append() back to the list.




