def uniq(pipe):
    ''' this works like bash's uniq command where the generator only iterates
        if the next value is not the previous '''
    pipe = iter(pipe)
    previous = next(pipe)
    yield previous
    for i in pipe:
        if i is not previous:
            previous = i
            yield i
def uniq ( pipe ) : pipe = iter ( pipe ) previous = next ( pipe ) yield previous for i in pipe : if i is not previous : previous = i yield i
this works like bash's uniq command where the generator only iterates
        if the next value is not the previous