-
-
Notifications
You must be signed in to change notification settings - Fork 29.2k
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 group() to itertools #45984
Comments
One question which is asked with surprising frequency in #python is how The "grouper" function in the itertools recipes page provides one def group(iterable, n=2):
return itertools.izip(*(iter(iterable),)*n) This code is fairly opaque to the novice. It is ugly, and takes a bit of There is a related function which is asked for much less frequently, but list(group([1, 2, 3, 4], n=2, step=1)) -> [(1, 2), (2, 3), (3, 4)] The original function is equivalent to this function when step is equal Please find attached a patch with implementation, documentation, and tests. |
Sorry, I'm not interested in adding this to the module. Discussions to- |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: