11
The Toolz Package
The toolz package, offered by the pytoolz project on GitHub, contains a number of functional programming features. Specifically, these libraries offer iteration tools, higher-order function tools, and even some components to work with stateful dictionaries in an otherwise stateless function application.
There is some overlap between the toolz package and components of the standard library. The toolz project decomposes into three significant parts: itertoolz, functoolz, and dicttoolz. The itertoolz and functoolz modules are designed to mirror the standard library modules itertools and functools.
We’ll look at the following list of topics in this chapter:
We’ll start with star-mapping, where a
f(*args)is used to provide multiple arguments to a mappingWe’ll also look at some additional
functools.reduce()topics using theoperatormoduleWe’ll look at the
toolzpackage, which provides capabilities similar to the built-initertools...