The functools module provides higher-order functions and operations on callable objects. It allows for powerful functional programming patterns in Python.
Memoization with lru_cache
Memoization caches the results of expensive function calls. Python provides decorators for this.
Partial Functions
partial freezes some portion of a function's arguments and/or keywords, resulting in a new object with a simplified signature.
Ordering Classes
@total_ordering fills in missing ordering methods (__le__, __gt__, etc.) given a class that defines __eq__ and one other comparison method.
Single Dispatch
@singledispatch transforms a function into a generic function, which can have different behaviors depending on the type of its first argument.