def uniq(sequence):
    '''Removes the duplicates from the given sequence, preserving the order
       of the remaining elements.'''
    dict = {}
    try:
        return [dict.setdefault(i,i) for i in sequence if i not in dict]
    except TypeError:   # unhashable item(s)
        return [dict.setdefault(repr(i),i) for i in sequence if repr(i) not in dict]
Removes the duplicates from the given sequence, preserving the order
       of the remaining elements.
recipes/Python/270589_Unitsafe_measured_quantities/recipe-270589.py