Best way to make a list unique?

Eric Pederson whereU at
Sun Mar 6 12:57:28 CET 2005

I have 

>>> listA=[1,2,3,4,5,4,3,4,3,2,1]

and I want a list of only the unique members.

This seems inefficient, but works fine over my small sample lists:

>>> listA=[a for a in set(listA)]

Is there a more efficient approach for cases where listA is large?

Eric Pederson
ePrefix="".join([chr(ord(x)+1) for x in "do"])

More information about the Python-list mailing list