Message318770
Ni!
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)
function(1, 2)
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.
Cheers! |
|
Date |
User |
Action |
Args |
2018-06-05 16:58:55 | solstag | set | recipients:
+ solstag, docs@python |
2018-06-05 16:58:55 | solstag | set | messageid: <1528217935.32.0.592728768989.issue33774@psf.upfronthosting.co.za> |
2018-06-05 16:58:55 | solstag | link | issue33774 messages |
2018-06-05 16:58:55 | solstag | create | |
|