How can you implement a custom comparator for 'in' using python
<p>If i had a class like this:</p>

<pre><code>class foo(object):
    def __init__(self, x, y, z):
         self.x = x
         self.y = y
         self.z = z
</code></pre>

<p>In a list like this:</p>

<pre><code>list = [foo(1, 2, 3), foo(4, 5, 6), foo(7, 8, 9)]
</code></pre>

<p>How could i create a custom test for 'in' such that it checks only x and z values such that this:</p>

<pre><code>new_foo = foo(1,8,3)
if new_foo in list:
    print True
else:
    print False
</code></pre>

<p>Would print True</p>
