Testing for value in set of tuples
<p>Suppose we have the following set, <code>S</code>, and the value <code>v</code>:</p>

<pre><code>S = {(0,1),(2,3),(4,5)}
v = 3
</code></pre>

<p>I want to test if <code>v</code> is the second element of any of the pairs within the set. My current approach is:</p>

<pre><code>for _, y in S:
    if y == v:
        return True
return False
</code></pre>

<p>I don't really like this, as I have to put it in a separate function and something is telling me there's probably a nicer way to do it. Can anyone shed some light?</p>
