In Python, a list is a mutable sequence written with square brackets, and a tuple is an immutable sequence written with parentheses; once a tuple is created, its items cannot be added, removed or replaced. Both keep their order, allow duplicates and hold items of any type, so the choice comes down to whether the data should change.
cart = ["tea", "milk"] # a list, can change
cart.append("rice") # ['tea', 'milk', 'rice']
point = (12.5, 7.0) # a tuple, fixed
We compare the two side by side, look at immutability and hashing, measure memory with sys.getsizeof(), and cover the single-element tuple trap and named tuples. The numbers come from Python 3.14.
1. Lists vs Tuples at a Glance
Most differences follow from one fact, that a tuple cannot change after it is created.
| Feature | List | Tuple |
|---|---|---|
| Syntax | [1, 2, 3] | (1, 2, 3) or 1, 2, 3 |
| Mutable | Yes | No |
| Methods | append(), remove(), sort() and more | Only count() and index() |
| Usable as a dict key or set item | No | Yes, if all items are hashable |
| Size of 3 integers (Python 3.14) | 88 bytes | 72 bytes |
| Typical use | A collection that grows or changes | A fixed record, such as coordinates or a row |
2. Mutable Lists vs Immutable Tuples
A list can be changed in place. A tuple has no methods that change it, and item assignment raises TypeError.
nums = [1, 2, 3]
nums[0] = 10 # [10, 2, 3]
nums.append(4) # [10, 2, 3, 4]
fixed = (1, 2, 3)
bad = fixed.append(4) # AttributeError: 'tuple' object has no attribute 'append'
fixed2 = fixed + (4,) # (1, 2, 3, 4), a new tuple
Immutability is shallow, so a tuple that holds a list cannot swap the list for another object, but the list inside can still change.
record = ("Ana", [90, 85])
record[1].append(77) # ('Ana', [90, 85, 77])
3. Tuples as Dictionary Keys
Dictionary keys and set members must be hashable, and a tuple is hashable when all its items are. That makes tuples the natural key for data indexed by two values, such as a grid position or a date and a city.
temps = {("Pune", "2026-10-09"): 31, ("Delhi", "2026-10-09"): 34}
pune = temps[("Pune", "2026-10-09")] # 31
bad_key = {[1, 2]: "x"} # TypeError: cannot use 'list' as a dict key (unhashable type: 'list')
bad_tuple = {(1, [2]): "x"} # TypeError: cannot use 'tuple' as a dict key (unhashable type: 'list')
4. Memory and Speed
A tuple of the same items uses less memory than a list, because a list keeps spare room for future appends. On Python 3.14, sys.getsizeof() reports these sizes for the container itself, without the items.
import sys
t3 = sys.getsizeof((1, 2, 3)) # 72
l3 = sys.getsizeof([1, 2, 3]) # 88
t10 = sys.getsizeof(tuple(range(10))) # 128
l10 = sys.getsizeof(list(range(10))) # 136
Creating a tuple of constants is faster than creating a list, because Python can store the tuple once at compile time. For iterating and indexing, the difference is too small to matter, so we choose by meaning, not by speed.
5. The Single-Element Tuple Trap
Parentheses alone do not make a tuple; the comma does. A tuple with one item needs a trailing comma, otherwise Python sees an ordinary value in parentheses.
not_tuple = (5) # 5, an int
one = (5,) # (5,), a tuple
also_one = 5, # (5,), the comma is enough
empty = () # (), the empty tuple
6. Named Tuples for Readable Records
A tuple used as a record gets hard to read when we access fields as row[2]. A named tuple keeps the tuple’s behavior and adds field names.
from collections import namedtuple
Point = namedtuple("Point", ["x", "y"])
p = Point(12.5, 7.0)
x_value = p.x # 12.5
as_tuple = tuple(p) # (12.5, 7.0)
For records that need to change, a dataclass (a class declared with @dataclass, which generates the constructor and comparison methods) is the better fit; for fixed records that are created often, a named tuple or a plain tuple is lighter.
7. Lists vs Tuples FAQs
Converting between the two, returning several values and sorting complete the picture.
7.1. How do we convert between a list and a tuple?
The constructors do it, tuple(my_list) and list(my_tuple). Both create a new object and leave the original unchanged.
7.2. Why do functions return tuples?
A return a, b statement returns the tuple (a, b), which the caller unpacks with x, y = f(). The fixed shape of a tuple fits a fixed number of return values.
7.3. Can we sort a tuple?
Not in place, because a tuple is immutable, but sorted(my_tuple) returns a new sorted list, and tuple(sorted(my_tuple)) turns it back into a tuple.
8. Conclusion
Lists suit collections that change, and tuples suit fixed records, dictionary keys and return values. A tuple is hashable only when its items are, a single-element tuple needs a comma, and named tuples add field names when plain indexes get hard to read.
9. References
Happy Learning !!