def unique ( iterable ) : seen = set ( ) for item in iterable : if item not in seen : seen . add ( item ) yield item
filter unique items in python
Filter out duplicate items from an iterable
def unique(iterable):
    """Filter out duplicate items from an iterable"""
    seen = set()
    for item in iterable:
        if item not in seen:
            seen.add(item)
            yield item