What does `functools.lru_cache` use as a cache key when decorating a function?

Python Professional Hard

Python Professional — Hard

What does `functools.lru_cache` use as a cache key when decorating a function?

Key points

  • The cache key includes both positional and keyword arguments.
  • All arguments must be hashable to be used as a cache key.
  • This approach allows the function to cache results based on specific input combinations.

Ready to go further?

Related questions