Brian van den Broek <[EMAIL PROTECTED]> wrote:
   ...
> >>> orig_list = [3,1,2,3,1,2,3,1,2,1,2,1,3]
> >>> new_list = list(set(orig_list))
> >>> new_list.sort(cmp= lambda x,y: cmp(orig_list.index(x), 
> orig_list.index(y)))
> >>> new_list
> [3, 1, 2]
> >>>

A better way to exploit exactly the same idea is to use:

new_list.sort(key=orig_list.index)


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

Reply via email to