Python · The language, not just syntax

When should you use a list versus a tuple?

EasyliststuplesimmutabilityUpdated Oct 2026
Quiz this track

Short answer

Use a list for a homogeneous, growing sequence that changes, and a tuple for a fixed-length record or immutable sequence. Tuples are hashable when their contents are, so they can be dictionary keys and set members.

Both are ordered sequences with O(1) indexing, but a list supports append, insert and item assignment while a tuple does not. A tuple has a smaller memory footprint and can be cached and reused by CPython, which also makes it slightly cheaper to create.

python
point = (10.0, 20.0)
x, y = point

cache = {}
cache[point] = "origin offset"

row = [10.0, 20.0]
row.append(0.0)
print(x, y, cache[point], row)
The tuple works as a key because it is hashable. The list supports growth and in-place mutation.

Choosing by intent

  • Tuple: a fixed record such as a coordinate, a database row or a function return
  • List: an ordered collection that will be appended to, filtered or reordered
  • Tuple: when the value must be hashable for dict keys or set membership
  • List: when the caller expects mutable sequence semantics

Immutability is shallow. A tuple holding a list cannot be modified structurally, but the list inside it can still change, and then the tuple is no longer safely hashable. For named fixed records, collections.namedtuple or a frozen dataclass is usually clearer than positional indexing.

Do not use a tuple purely because it is marginally faster. Choose based on whether the value is a fixed record or a collection that changes.

Follow-ups you should expect

Interviewers use these to check whether the first answer was understanding or memorisation.

  1. 1Why can a tuple be a dict key but a list cannot?
  2. 2Is a tuple always hashable?
  3. 3When would you use a namedtuple instead of a tuple?
  4. 4How does tuple unpacking interact with starred targets?

Say it in the interview

I use a list when I have a homogeneous collection that changes and a tuple when I have a fixed-length record or need an immutable, hashable sequence. Tuples use less memory and can be dictionary keys, but their immutability is shallow. For named records I prefer a namedtuple or a frozen dataclass so the code documents the fields instead of relying on positions.

Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.

Related questions

Reading is step one

Now say it out loud.

Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live Python mock interview and get scored feedback on depth, clarity and confidence.