Skip to content
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

fix: sort iterable before passing it to itertools.groupby() #112

Merged
merged 2 commits into from
Jul 18, 2024

Conversation

jnussbaum
Copy link
Collaborator

@jnussbaum jnussbaum commented Jul 18, 2024

According to the docs, the iterable must be sorted on the same key function, before passing it to itertools.groupby():
https://docs.python.org/3/library/itertools.html#itertools.groupby

@jnussbaum jnussbaum self-assigned this Jul 18, 2024
@jnussbaum jnussbaum changed the title fix: sort iterable before passing to itertools.groupby() fix: sort iterable before passing it to itertools.groupby() Jul 18, 2024
Copy link
Collaborator

@Nora-Olivia-Ammann Nora-Olivia-Ammann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is only slightly more readable to me. To make it even better I would create a function that returns the entire iter generator.

@jnussbaum jnussbaum enabled auto-merge (squash) July 18, 2024 11:30
@jnussbaum jnussbaum merged commit db8cb53 into main Jul 18, 2024
1 check passed
@jnussbaum jnussbaum deleted the wip/fix-groupby branch July 18, 2024 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants