title: Why are Python's arrays slow?
body: <p>I expected <code>array.array</code> to be faster than lists, as arrays seem to be unboxed.</p>
  
  <p>However, I get the following result:</p>
  
  <pre class="lang-none prettyprint-override"><code>In [1]: import array
  
  In [2]: L = list(range(100000000))
  
  In [3]: A = array.array('l', range(100000000))
  
  In [4]: %timeit sum(L)
  1 loop, best of 3: 667 ms per loop
  
  In [5]: %timeit sum(A)
  1 loop, best of 3: 1.41 s per loop
  
  In [6]: %timeit sum(L)
  1 loop, best of 3: 627 ms per loop
  
  In [7]: %timeit sum(A)
  1 loop, best of 3: 1.39 s per loop
  </code></pre>
  
  <p>What could be the cause of such a difference?</p>