title: Python: how to map one list and one list of list together
body: <p>So I'm trying to get rid of some nested loops through map() and have trouble with a specific case.</p>
  
  <p>I have two lists:</p>
  
  <p>List1 = [1, 2, 3, 4, 5]</p>
  
  <p>List2 = [[1, 2, 3], [5], [1, 6], [1, 0, 9, 10], [1, 5, 2]]</p>
  
  <p>So basically list1 and list 2 are the same lengths, but list 2 is a list of lists of variable lengths.</p>
  
  <p>I want to call some function on the equivalent of;</p>
  
  <p>(1,1), (1,2), (1,3), (2,5), (3,1), (3,6), (4,1), (4,0), (4,9) (4,10), (5,1), (5,5), (5,2)</p>
  
  <p>using map. The first parameter of the tuple is from List1 and the second one is from the i'th equivalent of list1 on list2, with the sublist expanded.</p>
  
  <p>so right now I have:</p>
  
  <p>map(function, zip(list1, list2))</p>
  
  <p>but I cannot see how I could expand list2 to get what I just described. I think it might involve list comprehensions, but I'm having a little trouble and trial and error didn't get me very far.</p>
  
  <p>Another question is, if the inner function in this nested loop is susceptible to get called millions of times, will map() be significantly faster than just a for loop?</p>