Merge/append lists that share a common item
<p>The title may be misleading, so feel free to change the wording when the terminology for the real problem arises. =)</p>

<p>In this case, I am aware that the lists can probably be interchanged with tuples, for the most part. The end result can be any iterable as far as I'm concerned.</p>

<p>I have two lists-of-lists. Suppose they are: </p>

<pre><code>list_a = [[1, 'f00d'], [2, 'dead'], [3, 'beef']]
list_b = [[1, 'frankenbeans'], [2, 'chickensoup'], [3, 'spaceballs']]
</code></pre>

<p>Neither list is <em>necessarily</em> the same length, nor is guaranteed that they contain a common first element. </p>

<p>What I'm trying to do is create a new list-of-lists/list-of-tuples/list-of-dicts/whatever, as such: </p>

<pre><code>list_c = [[1, 'f00d', 'frankenbeans'], [2, 'dead', 'chickensoup'], [3, 'beef', 'spaceballs']
</code></pre>

<p><strong>Updated</strong>:
Basically, I know the position of the common "ID" in these lists, though it is <em>not necessarily sequential, nor are the lists-of-lists in the same order</em> (but is an integer). I'm looking for an efficient way to create a new set of the sub-lists, based on that common ID. </p>

<p>The naive way: </p>

<pre><code>new_list = []
for list_a_list in list_a:
  for list_b_list in list_b:
    if list_a_list[0] = list_b_list[0]:
      new_list.append([list_a_list[0], list_a_list[1], list_b_list[1]])
</code></pre>

<p>... or some such. Giving me the feeling that there's a much "smarter" way to do this, but I kinda suck at that.  </p>

<p><strong>Update:</strong><br>
Does it add any bearing if I mention that the list-of-lists each carry thousands to a million items at a time?</p>
