[Python-Dev] [Python-ideas] itertools.chunks(iterable, size, fill=None)
anatoly techtonik
techtonik at gmail.com
Thu Jul 5 15:47:53 CEST 2012
On Sun, Jul 1, 2012 at 3:01 PM, Stefan Behnel <stefan_ml at behnel.de> wrote:
>
> To address the main problem of users not finding what they need, what about
> simply extending the docstring of the grouper() function with a sentence
> like this:
>
> "This functionality is also called 'chunking' or 'blocking' and can be used
> for load distribution and sharding."
>
> That would make it easy for users to find what they are looking for when
> they search the page for "chunk". I find that a much more common and less
> ambiguous name than "grouping", which reminds me more of "group by".
In appeared that "chunking" and "grouping" are different kind of
tasks. You can chunk a sequence (sting) by slicing it into smaller
sequences, but you can not chunk in iterable - you can only group it.
There is an data loss about the structure that occurs when a sequence
(string) becomes an iterator:
chunks ABCDE -> AB CD E
group ABCDE -> A B C D E -> (A B) (C D) (D E)
More information about the Python-Dev
mailing list