Duplicates in lists
Timothy Grant
tjg at avalongroup.net
Thu Mar 9 16:39:30 EST 2000
Michael Husmann wrote:
> is there someone who has an efficient function that finds
> all duplicates in a list?
> I used a hash which works quite reasonable but maybe there
> is a better way.
Michael,
This topic was discussed very recently, and a number of good posts would
have been archived, so I suggest going and searching Deja, in the
meantime here is my version, which I thought was as short as possible,
but which was later bested.
def Unique(theList):
uniqueList = []
for value in theList:
if value in uniqueList:
continue
uniqueList.append(value)
return uniqueList
--
Stand Fast,
tjg.
Chief Technology Officer tjg at exceptionalminds.com
Red Hat Certified Engineer www.exceptionalminds.com
Avalon Technology Group, Inc. (503) 246-3630
>>>>>>>>>>>>Linux...Because rebooting isn't normal<<<<<<<<<<<<
More information about the Python-list
mailing list