def dedup ( seq ) : seen = set ( ) for item in seq : if item not in seen : seen . add ( item ) yield item
python list dedup in order
Remove duplicates from a list while keeping order .
def dedup(seq):
    """Remove duplicates from a list while keeping order."""
    seen = set()
    for item in seq:
        if item not in seen:
            seen.add(item)
            yield item