insert unique data in a list

mattia gervaz at gmail.com
Sun Dec 13 11:37:20 EST 2009


How can I insert non-duplicate data in a list? I mean, is there a 
particular option in the creation of a list that permit me not to use 
something like:
def append_unique(l, val):
    if val not in l:
        l.append(val)

Thanks, 
Mattia



More information about the Python-list mailing list