How do I use functools

In Python, the `functools` module is a standard library that provides higher-order functions for functional programming. It includes utility functions like `lru_cache`, `partial`, and `reduce` that can help you optimize and manipulate other functions.

Keywords: functools, Python, lru_cache, partial, reduce, higher-order functions
Description: Learn how to use the functools module in Python to optimize and simplify function calls, making your code more efficient and easier to read.

# Example of using functools in Python

from functools import lru_cache

@lru_cache(maxsize=32)
def fibonacci(n):
    if n < 2:
        return n
    return fibonacci(n - 1) + fibonacci(n - 2)

print(fibonacci(10))  # Output: 55
    

Keywords: functools Python lru_cache partial reduce higher-order functions