title: How come list element lookup is O(1) in Python?
body: <p>Today in class, we learned that retrieving an element from a list is <code>O(1)</code> in Python. Why is this the case? Suppose I have a list of four items, for example:</p>
  
  <pre><code>li = ["perry", 1, 23.5, "s"]
  </code></pre>
  
  <p>These items have different sizes in memory. And so it is not possible to take the memory location of <code>li[0]</code> and add three times the size of each element to get the memory location of <code>li[3]</code>. So how does the interpreter know where <code>li[3]</code> is without having to traverse the list in order to retrieve the element?</p>