The (small) disadvantage over Mike Watkins' version when compared to Dave Kirby's version is that Mike's version walks the given sequence twice. That means that it cannot be a generator, while Dave's version will handle generators just fine.
The coffee-corrected return for f13 (above) should be:
return [item for item in seq if item in uniq and not uniq.remove(item)]
Essentially the inverse of Dave Kirby's approach but just a hair faster for whatever reason set() only knows.
Comment
The (small) disadvantage over Mike Watkins' version when compared to Dave Kirby's version is that Mike's version walks the given sequence twice. That means that it cannot be a generator, while Dave's version will handle generators just fine.
Parent comment
The coffee-corrected return for f13 (above) should be: return [item for item in seq if item in uniq and not uniq.remove(item)] Essentially the inverse of Dave Kirby's approach but just a hair faster for whatever reason set() only knows.