title: Better to use dict of integer keys or a very long list?
body: <p>Basically, I need to make a lookup table with non-consecutive integer IDs. I'm wondering whether, in terms of lookup speed, I'm generally better off using a <code>dict</code> with integer keys anyway, or using a very long <code>list</code> with a lot of empty indices. It seems to me that a <code>list</code> might still be faster, as Python should know exactly where to look, but I'm wondering if there are any backend processes with the <code>dict</code> to compensate and whether the additional memory requirements for those empty <code>list</code> slots would negate the (probably) more easily traversed <code>list</code>'s speed gains. Are there any alternatives to <code>list</code>s and <code>dict</code>s that might be better suited to this? </p>
  
  <p>I have seen this question, but it doesn't totally answer mine: <a href="https://stackoverflow.com/questions/8403681/dictionary-access-speed-comparison-with-integer-key-against-string-key">Dictionary access speed comparison with integer key against string key</a></p>
  
  <p>ETA: I'm implementing lookup tables like this twice in my program. One instance sees a max id of 5,000 with 70-100 objects populated; the other has a max id of 750 with 20-30 populated. </p>