Skip to content

Instantly share code, notes, and snippets.

@ramalho
Created December 18, 2011 21:18
Show Gist options
  • Select an option

  • Save ramalho/1494494 to your computer and use it in GitHub Desktop.

Select an option

Save ramalho/1494494 to your computer and use it in GitHub Desktop.
Using counter (from Christian Perone, with listcomp instead of filter)
from collections import Counter
l = Counter([1,2,3,3,3,4])
co = filter(lambda n: l[n]==1 , l)
ct = [n for n in l if l[n]==1]
assert co == ct
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment