[docs] [issue33774] Improve doc of @lru_cache to avoid misuse and confusion
report at bugs.python.org
Tue Jun 5 12:58:55 EDT 2018
New submission from Al-Scandar Solstag <solstag at member.fsf.org>:
It is not clear at all in the documentation of @lru_cache that the cache takes into account the exact way the function was called, not the values passed to its arguments, as one could/would expect.
I mean that for function(a, b, c=3) the three calls below are not considered equivalent as far as the cache is concerned:
function(1, 2, 3)
function(1, 2, c=3)
I hope this can be clarified in the documentation. I wasted a great deal of time today trying to understand why my calls were not getting cached and only figured it out when I decided to go read @lru_cache's code.
It seems very likely that other people have had the same problem. Or worse, people might be using @lru_cache believing it is working when it isn't.
assignee: docs at python
nosy: docs at python, solstag
title: Improve doc of @lru_cache to avoid misuse and confusion
Python tracker <report at bugs.python.org>
More information about the docs