immutable collection: tuple as dictionary key
examples/dictionary/tuple_as_key.py
points = {} p1 = (2, 3) points[p1] = 'Joe' points[(17, 5)] = 'Jane' print(points) for k in points.keys(): print(k) print(k.__class__.__name__) print(points[k])
{(2, 3): 'Joe', (17, 5): 'Jane'}
(2, 3)
tuple
Joe
(17, 5)
tuple
Jane