New submission from Al-Scandar Solstag <sols...@member.fsf.org>:
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! ---------- assignee: docs@python components: Documentation messages: 318770 nosy: docs@python, solstag priority: normal severity: normal status: open title: Improve doc of @lru_cache to avoid misuse and confusion _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue33774> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com