Last active
November 12, 2015 20:37
-
-
Save anna-hope/6b35f10555c786397876 to your computer and use it in GitHub Desktop.
make chunks from an iterable for parallel processing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def make_parallel_chunks(sequence, num_chunks, chunk_size): | |
| for i in range(0, num_chunks, chunk_size): | |
| yield itertools.islice(sequence, i, chunk_size + i) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment