title: python map vs itertools.map: Make the iterator version behave like the former
body: <p>Consider the following example code. The example is given just to highlight the different functionality between <code>map</code> and <code>itertools.imap</code>. What I really want to do cannot be 
  done with a list comprehension because in my real problem I am not creating a list but filling a larger numpy array with small arrays. So in response to the code below, please do not suggest: <code>[f(x) for x in range(3)]</code></p>
  
  <p>Example:</p>
  
  <pre><code>g = []
  
  def f(x):
      g.append(x)
  </code></pre>
  
  <p>The results I get with <code>map</code> and itertools.map:</p>
  
  <pre><code>map(f, range(3)) # Results in g = [0,1,2]
  
  itertools.imap(f, range(3)) # Does not change g
  </code></pre>
  
  <p>I want the <code>g</code> to change as done by the <code>map</code> function. 
  However, I have heard that <code>map</code> will (or does) behave like 
  <code>itertools.imap</code> in Python 3. Even though I am using Python 2.7 I want to learn the correct way of using an iterator version of the map. How do I use <code>itertools.imap</code> to achieve
  the same outcome as I get with <code>map</code>?</p>
  
  <p>I can do:</p>
  
  <pre><code>b = itertools.imap(f, range(3))
  list(b) # This gives g = [0,1,2] if starting with an empty g.
  </code></pre>
  
  <p>Is this the correct way, or is there a better way?</p>
  
  <p>Thanks in advance.</p>