Intersection of instance data and list
<p>I have a list of instances of a class:</p>

<pre><code>&gt;&gt;&gt; class A:
...     
...     def __init__(self,l=None):
...         self.data=l

&gt;&gt;&gt; k=list()
&gt;&gt;&gt; for x in range(5):
...     k.append(A(x))
</code></pre>

<p>Now I need to intersect the 'data' field against a given list</p>

<pre><code>&gt;&gt;&gt; m=[0,2]
&gt;&gt;&gt; f=set([r.data  for r in k]) &amp; set(m)
&gt;&gt;&gt; f
set([0, 2])
</code></pre>

<p>So far so good.
But now, I need to get the instances of 'A' which had 'data' having one the values in intersection set 'f'.</p>

<p>Is there an easier way to achieve all of this - rather than iterating through instances again? </p>
