title: Python 3 vs Python 2 map behavior
body: <p>In Python 2, a common (old, legacy) idiom is to use <code>map</code> to join iterators of uneven length using the form <code>map(None,iter,iter,...)</code> like so:</p>
  
  <pre><code>&gt;&gt;&gt; map(None,xrange(5),xrange(10,12))
  [(0, 10), (1, 11), (2, None), (3, None), (4, None)]
  </code></pre>
  
  <p>In Python 2, it is extended so that the <em>longest</em> iterator is the length of the returned list and if one is shorter than the other it is padded with <code>None</code>.</p>
  
  <p>In Python 3, this is different. First, you cannot use <code>None</code> as an argument for the callable in position 1:</p>
  
  <pre><code>&gt;&gt;&gt; list(map(None, range(5),range(10,12)))
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  TypeError: 'NoneType' object is not callable
  </code></pre>
  
  <p>OK -- I can fix that like so:</p>
  
  <pre><code>&gt;&gt;&gt; def f(*x): return x    
  ... 
  &gt;&gt;&gt; list(map(f, *(range(5),range(10,12))))
  [(0, 10), (1, 11)]
  </code></pre>
  
  <p>But now, I have a different problem: <code>map</code> returns the <em>shortest</em> iterator's length -- no longer padded with <code>None</code>. </p>
  
  <p>As I port Python 2 code to Python 3, this is not a terrible rare idiom and I have not figured out an easy in place solution. </p>
  
  <p>Unfortunately, the 2to3 tools <a href="http://blog.bitsrc.org/2009/10/of-python3s-map.html" rel="noreferrer">does not</a> pick this up -- unhelpfully suggesting:</p>
  
  <pre><code>-map(None,xrange(5),xrange(10,18))
  +list(map(None,list(range(5)),list(range(10,18)))) 
  </code></pre>
  
  <p>Suggestions?</p>
  
  <hr>
  
  <p><em>Edit</em></p>
  
  <p>There is some discussion of how common this idiom is. <a href="https://stackoverflow.com/questions/1277278/python-zip-like-function-that-pads-to-longest-length">See this SO post</a>. </p>
  
  <p>I am updating legacy code written <em>when I was still in high school.</em> Look at the 2003 Python tutorials being <a href="http://mail.python.org/pipermail/python-dev/2003-August/037636.html" rel="noreferrer">written and discussed</a> by Raymond Hettinger with this specific behavior of map being pointed out...</p>