On Sep 29, 8:04 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
[snip]

> And I have another question. Which is the most efficient way to check if there
> are duplicate items in a list ? The items in the list may cannot be hashed, so
> set() may not work on the list.

The following classic by Tim Peters answers the question "How do I
remove duplicate items from a list".

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52560

It should help -- provided of course that you mean "duplicates" in the
sense that two Python objects a and b are duplicates iff a == b.
If you mean duplicates in a fuzzier sense e.g. "Mao Zedong" and "Mao
Tse-Tung", the problem gets harder ...

HTH,
John

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to