On Feb 22, 3:38 pm, Paul Rubin <http://[EMAIL PROTECTED]> wrote: > Paul McGuire <[EMAIL PROTECTED]> writes: > > I think you have this backwards. Should be: > > > if not any(x[0]==element[0] for x in a): > > a.append(element) > > I think you are right, it was too early for me to be reading code when > I posted that ;-)
I'm still getting used to 'any' and 'all' as new Python built-ins - but they'll do the short-circuiting as well as a for-loop-with-break. But I think a set- or dict-based solution will still surpass a list- based one for the OP. -- Paul -- http://mail.python.org/mailman/listinfo/python-list