How do I concatenate two lists in Python?
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
Python gives you several ways to combine two lists, and the best one depends on whether you want a new list or want to modify an existing list in place. The difference is small in syntax but important for correctness, memory use, and readability.
Using + Creates a New List
The most direct way to concatenate two lists is the + operator.
This creates a new list and leaves the original inputs unchanged. That makes it a good default when you want clear, predictable behavior.
Using extend() Modifies in Place
If you want to append all elements of one list into another existing list, use extend().
This changes left directly. It can be more memory-efficient than + because it avoids allocating a separate combined list, but that benefit only matters if mutating the original list is acceptable.
Unpacking Is Clean and Flexible
Python also supports iterable unpacking inside list literals. This is especially readable when you are combining more than two sources.
This still creates a new list, but it scales nicely when you want to combine several iterables in one expression.
itertools.chain() Is Useful for Lazy Iteration
Sometimes you do not actually need a materialized combined list yet. If you only need to iterate through the values, itertools.chain() avoids building a new list immediately.
If you later need a real list, you can still convert it:
append() Is Not Concatenation
One beginner mistake is using append() when the goal is concatenation.
This produces a nested list, not a flat combined list. The result is [1, 2, 3, [4, 5, 6]], which is usually not what you want.
Which Method Should You Choose
Use the method that matches the real requirement:
- Use
+when you want a new combined list. - Use
extend()when you want to modify one list in place. - Use unpacking when readability matters across multiple inputs.
- Use
chain()when lazy iteration is enough.
In most everyday code, + and extend() are the two answers you will reach for most often.
Performance and Intent
Micro-optimizing list concatenation is rarely the bottleneck in normal Python programs. Clarity usually matters more than chasing tiny differences. A readable left + right is often better than a more clever-looking construct unless you are in a genuinely performance-sensitive loop.
That said, repeatedly doing result = result + another_list inside a loop can be wasteful because each step creates a new list. If you are accumulating many lists over time, extend() or a different data-flow pattern may be more appropriate.
Combining Other Iterables
Remember that not every iterable is a list. If one side is a tuple, generator, or set, methods like extend() still work because they accept any iterable.
The result is still a list. That can be convenient, but it also means you should be aware of the target type you want to preserve.
Common Pitfalls
The biggest pitfall is using append() and accidentally creating a nested list. If the goal is a flat sequence, use extend() or +.
Another issue is forgetting that extend() mutates the original list. If other parts of your program still rely on the old value, in-place modification can introduce surprising bugs.
Developers also assume chain() returns a list. It does not. It returns an iterator, which is excellent for iteration but not for code that expects list methods or indexing.
Finally, do not ignore readability. Python gives you several valid ways to combine lists, but the simplest correct one is usually the best.
Summary
- '
left + rightcreates a new combined list.' - '
left.extend(right)modifiesleftin place.' - Unpacking with
[*left, *right]is a clean way to combine multiple iterables. - '
itertools.chain()is best when you want lazy iteration instead of an immediate list.' - '
append()adds one object and therefore does not perform list concatenation.'

