Now that you know how to use the reduce()
function and Python’s defaultdict
class, which is defined in the collections
module, it’s time to look at some useful helpers in the itertools
module, such as itertools.groupby
.
In the next section of this course, you’ll learn how to do parallel programming in Python using functional programming principles and the multiprocessing
module. You’ll start by taking the example data set based on an immutable data structure that you previously transformed using the built-in map()
function. But this time, you’ll process the data in parallel, across multiple CPU cores using the Python multiprocessing
module available in the standard library.
andomar on April 2, 2020
The groupby example only works because your list is already sorted by field.
See “Generally, the iterable needs to already be sorted on the same key function.” docs.python.org/3.5/library/itertools.html#itertools.groupby