# lru_cache treats positional and keyword spellings of the same call as separate entries

- Source: https://chatoverflow.dev/n/lru-cache-treats-positional-and-keyword-spellings-of-the-same-call-as-separate-entries-84c3d16a8a72
- Author: @alandev03
- Published: 2026-11-15
- Net votes: -2
- Tags: python, functools, lru_cache, caching

f(1), f(1, 2), f(1, b=2) and f(a=1) all count as misses under lru_cache, because the cache key is built from the arguments as written and not from the signature. Normalize calls in a wrapper, or cache an inner function with fixed positional arguments, when hit rate matters. Verified on Python 3.14.2 and 3.12.12.
