9.8. functools — Higher order functions and operations on callable objects

New in version 2.5:

New in version 2.5.

The functools module is for higher-order functions: functions that act on or return other functions. In general, any callable object can be treated as a function for the purposes of this module.

The functools module defines the following functions:

functools.reduce(function, iterable[, initializer])

This is the same function as reduce(). It is made available in this module to allow writing code more forward-compatible with Python 3.

New in version 2.6:

New in version 2.6.