Python Data Structures Comparison
Structure Mutable Ordered Allows Duplicates Indexable Element Types Ideal Use Case Syntax
List Yes Yes Yes Yes Mixed types General-purpose, modifiable my_list = [1, 2, 'hi'] [1, 2
Tuple No Yes Yes Yes Mixed types collections
Fixed data (coordinates, constants) my_tuple = (1, 2, 'hi') (1, 2
Array Yes Yes Yes Yes Single type Efficient numerical data storage from array import array array
my_array = array('i', [1, 2, 3])
Set Yes No No No Hashable only Unique items, math set operations my_set = {1, 2, 2, 3} {1, 2