rh0dium <[EMAIL PROTECTED]> writes: > found = False > for item in a: > if item[0] == element[0] > found = True > break > if not found: > a.append(element) > > But this is just ugly - Is there a simpler way to interate over all > items in a without using a found flag?
Untested and I'm not sure I understand the question completely, but try: if any(x==element[0] for x in a): a.append(element) -- http://mail.python.org/mailman/listinfo/python-list