-
Notifications
You must be signed in to change notification settings - Fork 319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add .duplicates() and .duplicates_by(..) operations #502
Conversation
3944a97
to
929f36d
Compare
929f36d
to
88072e8
Compare
88072e8
to
e822ec3
Compare
@jswrenn thanks for taking another look. I just rebased on top of master and I'm happy to resolve the naming as you see fit :) |
e822ec3
to
58940ea
Compare
@jswrenn should be good to merge now :) |
30f749d
to
5a620b8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kudos for unifying the implementations! I just have one last edit for you. :-)
5a620b8
to
e035b58
Compare
Uses a HashMap to detect duplicates in an iterator and emits them only once. Items are never cloned. Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
e035b58
to
e1090aa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this! This PR turned into a really excellent case-study in unifying similar implementations and using internal iteration, that I think will be really informative elsewhere in itertools.
bors r+
Build succeeded: |
Uses a HashMap to detect duplicates in an iterator and emits them only once. The implemention is similar to the
unique()
andunique_by()
methods but in this case the items are never cloned.