title: Populate a list in python
body: <p>I have a series of Python tuples representing coordinates:</p>
  
  <pre><code>tuples = [(1,1), (0,1), (1,0), (0,0), (2,1)]
  </code></pre>
  
  <p>I want to create the following list:</p>
  
  <pre><code>l = []
  for t in tuples:
    l[ t[0] ][ t[1] ] = something
  </code></pre>
  
  <p>I get an IndexError: list index out of range.</p>
  
  <p>My background is in PHP and I expected that in Python you can create lists that start with index > 0, i.e. make gaps and then fill them up, but it seems you can't.</p>
  
  <p>The idea is to have the lists sorted afterwards. I know I can do this with a dictionary, but as far as I know dictionaries cannot be sorted by keys. 
  <strong>Update</strong>: I now know they can - see the accepted solution.</p>
  
  <p>Edit:
  What I want to do is to create a 2D array that will represent the matrix described with the tuple coordinates, then iterate it in order.
  If I use a dictionary, i have no guarantee that iterating over the keys will be in order -> (0,0) (0,1) (0,2) (1,0) (1,1) (1,2) (2,0) (2,1) (2,2)</p>
  
  <p>Can anyone help?</p>