title: why list comprehension beats zip in transposing matrix
body: <p>Recently I'm using python to process some million sized list.</p>
  
  <p>Here I have a list <strong>E</strong>, it has 1,470,000 elements, each element is a list with 2 integers.</p>
  
  <p>E looks like: [[1, 3], [2, 4], [4, 7] ... ]</p>
  
  <p>I want to get the max number of the first column and the second column respectively.</p>
  
  <p>I can get it by using list comprehension</p>
  
  <pre><code>m1 = max([e[0] for e in E])
  m2 = max([e[1] for e in E])
  return (m1, m2)
  </code></pre>
  
  <p>Another method is to use zip:</p>
  
  <pre><code>list(map(max, zip(*E)))
  </code></pre>
  
  <p>At the first thought I think the second way should be faster, since the list comprehension is going to build a big list (what's more, for 2 times). But it turns out list comprehension to be extremely fast and the method using zip is around 10 ~ 20 times slower (using cProfile).</p>
  
  <p>I think the zip shouldn't be that slow, (what's more, how could a list comprehension to be that fast?) Can anybody tells me the reason?</p>
  
  <p>I'm using python 3.2</p>
  
  <p>P.S. by using Windows Task Manager, I can't even see any memory trace shows that python ever created a new list. There must be a black magic.</p>