Python Data Structures: Master Comparison Table
A quick-reference table covering all four built-in data structures in Python — List, Tuple, Set, and Dictionary.
| Feature / Method | List | Tuple | Set | Dictionary |
|---|---|---|---|---|
| Structure | Single items | Single items | Single items | Key-Value pairs |
| Order | Ordered | Ordered | Unordered | Ordered |
| Mutability | Mutable | Immutable | Mutable | Mutable |
| Duplicates | Allowed | Allowed | Not allowed | Keys unique / Values duplicate |
| Datatype Combinations | Mixed types allowed | Mixed types allowed | Mixed types (Hashable only) | Mixed types (Keys must be hashable) |
| Syntax | [ ] |
( ) |
{ } |
{ : } |
append |
True | — | — | — |
extend |
True | — | — | — |
insert |
True | — | — | — |
remove |
True | — | True | — |
pop |
True | — | True | True |
clear |
True | — | True | True |
index |
True | True | — | — |
sort |
True | — | — | — |
count |
True | True | — | — |
reverse |
True | — | — | — |
copy |
True | — | True | True |
add |
— | — | True | — |
discard |
— | — | True | — |
union |
— | — | True | — |
intersection |
— | — | True | — |
difference |
— | — | True | — |
issubset / isdisjoint |
— | — | True | — |
keys |
— | — | — | True |
values |
— | — | — | True |
items |
— | — | — | True |
get |
— | — | — | True |
update |
— | — | — | True |
popitem |
— | — | — | True |
setdefault |
— | — | — | True |
map |
True | True | True | True |
filter |
True | True | True | True |
Legend
- True — Method available
- — — Method not available
- Tuple is immutable, so it supports only
indexandcountout of all mutating / modifying methods. - Set members must be hashable (no lists, dicts, or other sets as elements).
- Dict keys must also be hashable; values can be any type.