Elegant way to create a dictionary of pairs, from a list of tuples?
<p>I have defined a tuple thus:
    (slot, gameid, bitrate)</p>

<p>and created a list of them called <code>myListOfTuples</code>. In this list might be tuples containing the same <code>gameid</code>.</p>

<p>E.g. the list can look like:</p>

<pre><code>[
   (1, "Solitaire", 1000 ),
   (2, "Diner Dash", 22322 ),
   (3, "Solitaire", 0 ),
   (4, "Super Mario Kart", 854564 ),
   ... and so on.
]
</code></pre>

<p>From this list, I need to create a dictionary of pairs - ( <code>gameId</code>, <code>bitrate</code>), where the <code>bitrate</code> for that <code>gameId</code> is the first one that I came across for that particular <code>gameId</code> in <code>myListOfTuples</code>.</p>

<p>E.g. From the above example - the dictionary of pairs would contain only <em>one</em> pair with <code>gameId</code> "Solitaire" : <code>("Solitaire", 1000 )</code> because 1000 is the first bitrate found.</p>

<p>NB. I can create a set of unique games with this:</p>

<pre><code>uniqueGames = set( (e[1] for e in myListOfTuples ) )
</code></pre>
