Skip to content

Instantly share code, notes, and snippets.

@fmayer
Created December 5, 2012 19:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fmayer/4218699 to your computer and use it in GitHub Desktop.
Save fmayer/4218699 to your computer and use it in GitHub Desktop.
>>> def foo(lst):
... last = object()
... for e in lst:
... if e != last:
... yield e
... last = e
>>> list(foo([1,1,1,2,4,1]))
0: [1, 2, 4, 1]
>>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment