sorting a list of tuples in Python
<p>While working on a problem from Google Python class, I formulated following result by using 2-3 examples from Stack overflow- </p>

<pre><code>def sort_last(tuples):
    return [b for a,b in sorted((tup[1], tup) for tup in tuples)]

print sort_last([(1, 3), (3, 2), (2, 1)])
</code></pre>

<p>I learned List comprehension yesterday, so know a little about list comprehension but I am confused how this solution is working overall. Please help me to understand this (2nd line in function).</p>
