cpython_sandbox / Doc / library / functools.rst

Full commit

:mod:`functools` --- Higher-order functions and operations on callable objects

Source code: :source:`Lib/`

The :mod:`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 :mod:`functools` module defines the following functions:

:class:`partial` Objects

:class:`partial` objects are callable objects created by :func:`partial`. They have three read-only attributes:

:class:`partial` objects are like :class:`function` objects in that they are callable, weak referencable, and can have attributes. There are some important differences. For instance, the :attr:`__name__` and :attr:`__doc__` attributes are not created automatically. Also, :class:`partial` objects defined in classes behave like static methods and do not transform into bound methods during instance attribute look-up.