[lang-ref] ( composite_key ) ( python )
def test_composite_key():
# use tuple
d = {}
d[(1, 2, 3)] = 'OK'
assert d[(1, 2, 3)] == "OK"
# while tuple is hashable, list is not.
with pytest.raises(TypeError):
d[[1, 2, 3]] = "NG"