Excellent! Thanks all. Since I need to have this running on python 2.4 as well, I think I'll choose,<br><div class="im"><br>for alpha in alist:<br>
    for xy in xlist:<br>
</div><div class="im">        if alpha+xy in checklist:<br>
            break<br>
    else:<br>
        missing.append(alpha)<br><br>jus tested and worked like a charm.<br><br>Appreciate your help!!<br><br></div><br><br><div class="gmail_quote">On Wed, Apr 8, 2009 at 6:12 PM, Luis Alberto Zarrabeitia Gomez <span dir="ltr"><<a href="mailto:kyrie@uh.cu">kyrie@uh.cu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im"><br>
Quoting PK <<a href="mailto:superprad@gmail.com">superprad@gmail.com</a>>:<br>
<br>
> So I'm trying to see whats the cleanest way to do this:<br>
><br>
> I have a<br>
><br>
> checklist = [ax, bx, by, cy  ..] (a combination of a,b,c with x and y,<br>
> either both on one)<br>
><br>
> allist = [a,b,c,....]<br>
> xlist = [x, y, ..]<br>
><br>
[...]<br>
</div><div class="im">> now the problem is I want to include alpha in missing list only if<br>
> none of the combinations from xlist with alpha are in checklist.<br>
<br>
</div>This is untested:<br>
<div class="im"><br>
for alpha in alist:<br>
    for xy in xlist:<br>
</div><div class="im">        if alpha+xy in checklist:<br>
            break<br>
    else:<br>
        missing.append(alpha)<br>
<br>
</div>(note that the "else" is for the "for", not the "if")<br>
<br>
You could also try the any/all functions from python2.5:<br>
<br>
for alpha in alist:<br>
    if not any(alpha + xy in checklist for xy in xlist):<br>
        missing.append(alpha)<br>
<br>
<br>
Or the really not recommended one-liner:<br>
<br>
missing = [alpha for alpha in alist if not any(alpha + xy in checklist for xy in<br>
xlist)]<br>
<br>
(remember, all of this is untested)<br>
<br>
--<br>
Luis Zarrabeitia<br>
Facultad de Matemática y Computación, UH<br>
<a href="http://profesores.matcom.uh.cu/%7Ekyrie" target="_blank">http://profesores.matcom.uh.cu/~kyrie</a><br>
<font color="#888888"><br>
<br>
--<br>
Participe en Universidad 2010, del 8 al 12 de febrero de 2010<br>
La Habana, Cuba<br>
<a href="http://www.universidad2010.cu" target="_blank">http://www.universidad2010.cu</a><br>
<br>
</font></blockquote></div><br>