Join Tuples in Python
Learn every way to join Python tuples: the + concatenation operator, the * repetition operator, and the tuple() constructor with examples.
Python tuples are immutable sequences — once created you cannot add, remove, or change their elements. Joining tuples means creating a new tuple that combines the contents of two or more existing tuples. Because tuples are immutable, every join operation returns a fresh tuple rather than modifying the originals.
This page covers the main ways to join tuples in Python:
+operator — concatenate two or more tuples*operator — repeat a tuple a fixed number of timestuple()constructor — build a tuple from any iterable, useful when combining non-tuple sequences
Joining Tuples with the + Operator
The + operator concatenates two tuples into a single new tuple. The elements from the left operand come first, followed by those from the right operand. Neither original tuple is changed.
Output:
(1, 2, 3, 4, 5, 6)Joining Three or More Tuples
Chain the + operator to merge any number of tuples in a single expression:
Output:
(1, 2, 3, 4, 5, 6, 7, 8, 9)Joining Tuples with Mixed Types
Tuples can hold values of different types, and + works the same way regardless:
t1 = (1, "hello", True)
t2 = (3.14, None)
result = t1 + t2
print(result)Output:
(1, 'hello', True, 3.14, None)Gotcha: Both Operands Must Be Tuples
You cannot use + to concatenate a tuple with a list or any other type — Python raises a TypeError. Convert the other sequence to a tuple first:
my_tuple = (1, 2, 3)
my_list = [4, 5, 6]
# This raises TypeError:
# result = my_tuple + my_list
# Correct — convert the list to a tuple first:
result = my_tuple + tuple(my_list)
print(result)Output:
(1, 2, 3, 4, 5, 6)Gotcha: Single-Element Tuple Syntax
A tuple with one element requires a trailing comma. Without it, Python treats the parentheses as grouping, not as a tuple literal:
not_a_tuple = (42) # int, not tuple
singleton = (42,) # tuple with one element
result = singleton + (1, 2)
print(result)Output:
(42, 1, 2)Repeating a Tuple with the * Operator
The * operator repeats a tuple a given number of times and returns a new tuple. This is useful when you need a sequence pre-filled with a repeated pattern.
t = ("a", "b")
result = t * 3
print(result)Output:
('a', 'b', 'a', 'b', 'a', 'b')The integer can appear on either side: t * 3 and 3 * t produce the same result. Multiplying by 0 or a negative number returns an empty tuple.
t = (1, 2, 3)
print(t * 0) # ()
print(t * 1) # (1, 2, 3)Output:
()
(1, 2, 3)Building a Combined Tuple with tuple()
The built-in tuple() constructor converts any iterable into a tuple. You can use it to build a combined tuple from a list that was assembled by appending to it, which is more efficient than repeated + calls inside a loop.
parts = [1, 2, 3]
parts += [4, 5, 6] # build up a list first
combined = tuple(parts) # convert to tuple once
print(combined)Output:
(1, 2, 3, 4, 5, 6)Why Avoid + Inside a Loop
Each + call creates a new tuple object and copies all elements. When joining many tuples, this means O(n²) copies. The efficient pattern is to collect all elements into a list and convert once at the end:
tuples = [(1, 2), (3, 4), (5, 6), (7, 8)]
# Inefficient — creates a new tuple on each iteration
result = ()
for t in tuples:
result = result + t # many intermediate copies
# Efficient — build a list, convert once
result = tuple(item for t in tuples for item in t)
print(result)Output:
(1, 2, 3, 4, 5, 6, 7, 8)Joining vs. Nesting Tuples
It is easy to accidentally nest tuples instead of joining them. The + operator flattens one level; wrapping tuples in a new tuple creates nested structure.
t1 = (1, 2)
t2 = (3, 4)
joined = t1 + t2 # flat: all four elements at the same level
nested = (t1, t2) # two-element tuple of tuples
print("joined:", joined)
print("nested:", nested)Output:
joined: (1, 2, 3, 4)
nested: ((1, 2), (3, 4))Use + when you want a flat result. Use (t1, t2) when you intentionally want a tuple of tuples (for example, a table of rows).
Choosing the Right Approach
| Goal | Approach |
|---|---|
| Merge two or three tuples into one | tuple1 + tuple2 |
| Merge many tuples efficiently | Build a list, then tuple(...) |
| Repeat a pattern N times | my_tuple * N |
| Convert a list to a tuple | tuple(my_list) |
Related Topics
- Python Tuples — creating, indexing, and slicing tuples
- Access Tuples — indexing and slicing tuple elements
- Update Tuples — workarounds for modifying immutable tuples
- Unpack Tuples — assigning tuple elements to variables
- Loop Tuples — iterating over tuple elements
- Tuple Methods —
count()andindex()reference - Join Lists — merging lists with
+,extend(), and more