On Sat, 23 Feb 2008 17:19:47 -0800, thebjorn wrote:
> On Feb 23, 6:18 pm, Paul Hankin <[EMAIL PROTECTED]> wrote:
>
>> IMO Jason's solution of testing containment in a generator is better
>> (more readable).
>> if element[0] not in (x[0] for x in a):
>> a.append(element)
>
> It may be more readable (although that's debatable), but it always
> traverses the entire list.
The ``not in`` stops if the element is found.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list