cache and lru_cache
@cache memoizes a function by its arguments, turning a recursive solution into top-down DP in one line. @lru_cache(maxsize=...) is the same with an optional size bound. Arguments must be hashable.
cmp_to_key
cmptokey turns a two-argument comparator (negative / zero / positive) into a key= for sorted, list.sort, min and max. Use it when the order depends on comparing two items together and can't be expressed as a single key, e.g. "Largest Number".
reduce and operator
functools.reduce folds an iterable into one value with a binary function. Use it for XOR-of-all, combining with a custom op, or gcd of a list; prefer sum, math.prod, max when they exist. The operator module supplies fast function versions of operators.
partial
functools.partial returns a new callable with some arguments pre-bound. Use it to build key functions, callbacks and strategy objects (LLD) without writing a lambda or a small class.
total_ordering and cached_property
@totalordering fills in the remaining comparison methods from eq plus one of lt/le/gt/ge. @cachedproperty computes an attribute once on first access and stores it on the instance. Both lean LLD (value objects, models) more than DSA.