Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Choose a Python collection by how you need to work with its contents: use a list for an editable, ordered sequence; a tuple for an ordered sequence whose item slots should stay fixed; a set for unique members and membership checks; and a dict to look up values by unique keys. The differences are about behavior, not a universal speed ranking.

The comparison below follows the Python 3.14.7 data structures tutorial, last updated September 12, 2026.

How do the four Python collection types differ?

Type What it holds Can it change? Order and duplicates How you retrieve contents
list An ordered sequence Yes Preserves sequence order; duplicate values are allowed By index or iteration
tuple An ordered sequence No item reassignment Preserves sequence order; duplicate values are allowed By index, iteration, or unpacking
set Unique members Yes No guaranteed order; duplicates are removed Membership tests and set operations
dict Key-value pairs Yes Keys are unique; iteration follows insertion order By key

These are different data models, so start with the behavior your program needs rather than choosing by a general claim about performance.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Can the collection change?

Lists, sets, and dictionaries are mutable

You can edit a list by adding, removing, replacing, sorting, or reversing its elements. For example, tasks = ["email", "review", "email"] keeps both occurrences of "email"; use a list when the entries or their order may need to change.

Sets can also be changed, including by adding or removing members. Dictionaries can be updated by adding keys or assigning new values to existing keys.

Tuples do not allow item reassignment

A tuple’s item references cannot be replaced after creation, making it suitable for a group of values intended to stay together. This immutability is shallow: a tuple can contain a mutable object such as a list, and that inner list can still be edited. The tuple itself does not become mutable; only the contained list changes.

Does the type preserve order?

Lists and tuples preserve sequence order

Both are sequences, so their elements retain positions and can be addressed by index. Use them when the order of entries is part of the data, such as steps in a process or coordinates in a point.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Sets do not promise an order

A set is an unordered collection with no duplicate elements. Do not select a set member by position or rely on the order in which a set prints or iterates.

Dictionaries iterate in insertion order

In the current Python documentation, dictionary iteration follows insertion order. A dictionary is still accessed by key rather than by treating it as a sequence of values.

Can the collection contain duplicates?

Lists and tuples can repeat values

For example, ["email", "review", "email"] retains both instances. This makes a list or tuple appropriate when repeated entries are meaningful.

Sets keep unique members

Adding duplicate values does not give a set multiple copies of the same member. This makes a set useful when the collection should represent distinct values.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Dictionary keys are unique

A dictionary cannot hold two separate entries for the same key. Assigning a value under an existing key replaces that key’s previous value; it does not add a second copy of the key. Different keys may still map to equal values.

How do you retrieve an item?

Use an index or iteration for lists and tuples

Use an index when you need an element at a known position, or iterate when you need to process the sequence. Tuples also support unpacking, which assigns their elements to variables:

point = (3, 5)
x, y = point

A one-item tuple needs a trailing comma: one = ("hello",). Parentheses alone do not create a tuple: ("hello") is a string expression.

Use membership tests and set operations for sets

Sets are built for asking whether a value is present and for comparing groups of members. Python supports union (|), intersection (&), difference (-), and symmetric difference (^). An empty set is created with set(); the expression {} creates an empty dictionary.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use a key for dictionary lookup

A dictionary associates labels or identifiers with values. For example:

scores = {"Mina": 92, "Leo": 87}
mina_score = scores["Mina"]

Use square-bracket lookup when the key is expected to exist. If the key may be absent, scores.get("Ari") returns None by default, or you can supply a fallback such as scores.get("Ari", 0). In contrast, scores["Ari"] raises KeyError if that key is missing.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What can be used as a dictionary key or set member?

Dictionary keys must be hashable, so a list cannot be a key. A tuple can be used only when all of its contents are themselves suitable hashable values. Set members likewise need to be hashable. If a value needs to change and cannot be represented by a hashable key or member, store it in a different structure, such as a list or as a dictionary value.

Which type should you choose?

  • Choose a list when you need an editable, ordered sequence and repeated entries may matter.
  • Choose a tuple when you need an ordered group whose item slots should not be reassigned, especially when unpacking naturally expresses the values.
  • Choose a set when uniqueness, membership checks, or relationships between groups are central, and order does not matter.
  • Choose a dictionary when each value should be found through a unique key.

These choices describe the types’ semantics. The Python tutorial cited here does not establish a quantitative speed or memory ranking, so do not infer one from this comparison.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.