title: Dictionary where keys are pair of integers in Python
body: <p>How is possible in Python to create a dictionary where the keys are pairs of integers? </p>
  
  <p>For example, if I do this:</p>
  
  <pre><code>mydict=dict()
  mydict[ [1,2] ] = 'xxx'
  </code></pre>
  
  <p>I get the error <code>TypeError: unhashable type: 'list'</code></p>
  
  <p>So I came up with two different solutions: strings or tuples as keys.</p>
  
  <p>A first solution seems to convert the pair of integers in their string representation:</p>
  
  <pre><code>mydict=dict()
  mydict[ str(1)+" "+str(2) ] = 'xxx'
  </code></pre>
  
  <p>while the second solution involves tuples:</p>
  
  <pre><code>mydict=dict()
  mydict[ tuple([1,2]) ] = 'xxx'
  </code></pre>
  
  <p>From some experiments I've found that the tuple solution is slower than the string one.
  Is there a more efficient and fast way to use simply two integers as keys?</p>