List vs Tuple vs Set

May 30, 2026 | 5 min read

List

Best for: iteration, appending, indexed access. Mutable.

Tuple

Best for: fixed records, return values, dictionary keys. Immutable and slightly faster for read-only.

Set

Best for: membership testing, deduplication. Partial support — some operations may fall back.

When to Choose

OperationBest Type
Loop over sequencelist or tuple
Append itemslist
Lookup by indexlist or tuple
Check membershipset (if supported) or dict
Return multiple valuestuple