This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author solstag
Recipients docs@python, solstag
Date 2018-06-05.16:58:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1528217935.32.0.592728768989.issue33774@psf.upfronthosting.co.za>
In-reply-to
Content
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!
History
Date User Action Args
2018-06-05 16:58:55solstagsetrecipients: + solstag, docs@python
2018-06-05 16:58:55solstagsetmessageid: <1528217935.32.0.592728768989.issue33774@psf.upfronthosting.co.za>
2018-06-05 16:58:55solstaglinkissue33774 messages
2018-06-05 16:58:55solstagcreate