Functools¶
Some classes that are applied to functions and change the way the function is
called. Some of those listed are present in the functools [0] module.
Functools for one function¶
complement(), negate the return value of the function. Equivalent tolambda func: not func.flip(), reverse the order of the arguments passed to the function. Equivalent tolambda func: lambda *args, **kwargs: func(*list(reversed(args)), **kwargs)functools.lru_cache(), cache the return value of a function.functools.partial(), partially set the arguments of a function.partial(), partially set the arguments of a function; also accepting placeholders.functools.partialmethod, same asfunctools.partial()but works on methods.
Functools for several functions¶
chained(), apply several functions (successively).