Question on lists
Kristofer Pettijohn
kristofer at cybernetik.net
Wed Jul 28 02:31:01 EDT 2004
Andrew Bennetts <andrew-pythonlist at puzzling.org> wrote:
> Nothing builtin that I know of, but it's trivial to write:
>
> def uniq(iterable):
> """Remove consecutive duplicates from a sequence."""
>
> prev = object()
> for element in iterable:
> if element != prev:
> prev = element
> yield element
Thank you! Easier than I thought. I don't know why I make things
so hard on myself.
--
Kristofer Pettijohn
kristofer at cybernetik.net
More information about the Python-list
mailing list