List, tuple or dictionary? How to pick the right Python container

Python gives you three everyday ways to hold a group of values. Here is how to tell them apart and choose the right one without overthinking it.

Published 2026-09-09 · by M.R. Sterling

Python beginners meet lists, tuples and dictionaries in the same week, and they all look like "a box that holds several things". They are not interchangeable, and choosing well early saves a lot of quiet bugs later.

Here is the short version, then the reasoning.

The one-line rule

  • Use a list when you have an ordered collection that will change.
  • Use a tuple when you have a fixed group of values that should not change.
  • Use a dictionary when you want to look things up by a name rather than by a position.

That covers most real decisions. The rest is detail.

Lists: ordered and editable

A list keeps its items in order, and you can add, remove and replace them. You write it with square brackets, and you reach an item by its position, starting at zero.

Reach for a list when you are collecting things as you go: rows read from a file, results building up inside a loop, a queue of jobs to process. If the answer to "will this grow or shrink?" is yes, it is a list.

Tuples: ordered and locked

A tuple looks like a list but uses round brackets, and once made it cannot be changed. That sounds like a limitation and it is actually the point.

Use a tuple when the group is really one thing made of parts, and changing a part would make no sense. A latitude and longitude pair. A row of fixed columns. A colour as red, green and blue. Because a tuple cannot change, Python can also use it as a dictionary key, which a list can never do.

A good instinct: if you would be surprised to see an item added or removed later, a tuple says so out loud.

Dictionaries: look up by name

A dictionary stores pairs. Each value has a key, and you fetch the value by its key instead of by a position. You write it with curly braces and key: value pairs.

This is the container that changes how you think. When you catch yourself remembering that "position 0 is the name and position 2 is the date", stop. That is a dictionary asking to be born. record["name"] never gets confused the way record[0] does.

Dictionaries are the natural shape for anything that arrives as labelled fields: a patient record, a config file, a parsed message, a row keyed by column name.

The mistake to avoid

The classic beginner tangle is a list of loosely remembered positions:

patient[0], patient[3], patient[7]

Six months later nobody knows what position 7 was. The same data as a dictionary reads itself: patient["mrn"]. Reach for names as soon as the positions start needing comments.

Where to go next

Collections are the backbone of everything else in Python, so it is worth getting comfortable with all three rather than defaulting to lists for everything. The book Collections: Lists, Tuples & Dicts walks through them one at a time with run-and-proven examples, and if your data is really labelled fields, Dictionaries: Labels for Data goes deeper on the container that beginners underuse the most.

Books that go deeper

More articles

One email when a new book lands

No schedule, no filler. Just the new titles and the odd free chapter.