[issue23030] lru_cache manual get/put
New submission from Constantin: In an effort for improved communication between stacked decorators, I would like to propose that all decorators providing caching mechanisms should provide the functions cache_info, cache_clear, cache_get and cache_put. The standard lib only provides functools.lru_cache as caching decorators, which already implements the former two. I have attached a patch to provide the latter two. On python-ideas there was also the idea to create a cache data structure and then have a decorator take its data structure as an argument. But it was argued that this could lead to some optimizations of the caching being impossible. I think my suggested approach should not impose a problem on highly optimized caching code, because every cache - no matter how optimized - must have some functionality to add something to the cache and lookup something in the cache. -- components: Library (Lib) files: lru_get_put.patch keywords: patch messages: 232476 nosy: ConnyOnny priority: normal severity: normal status: open title: lru_cache manual get/put type: enhancement versions: Python 3.5 Added file: http://bugs.python.org/file37415/lru_get_put.patch ___ Python tracker <http://bugs.python.org/issue23030> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23030] lru_cache manual get/put
Constantin added the comment: It may be the case, that an lru_cache does not provide the best strategy for reliably caching many base cases in recursively written code. I suggest that someday we think about a different caching paradigm which fits this purpose and add it to functools e.g. as functools.recopt_cache. This cache would then implement the same interface as lru_cache and therefore all code currently using lru_cache could benefit from recopt_cache with just one line of code change. Furthermore, by designing this interface, it becomes more probable that user defined caching decorators are compatible. Please remember: My suggestion isn't just about lru_cache, but about an interface for caching decorators. -- ___ Python tracker <http://bugs.python.org/issue23030> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23030] lru_cache manual get/put
Constantin added the comment: I understand your decision. Even though it makes my life a little bit harder, it is definitely not the end of the world, the end of Python or even the end for my libtco project. -- ___ Python tracker <http://bugs.python.org/issue23030> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1776674] glob.glob inconsistent
Changes by Constantin Veretennicov : -- nosy: +kveretennicov ___ Python tracker <http://bugs.python.org/issue1776674> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9584] Allow curly braces in fnmatch
Changes by Constantin Veretennicov : -- nosy: +kveretennicov ___ Python tracker <http://bugs.python.org/issue9584> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4573] zsh-style subpattern matching for fnmatch/glob
Changes by Constantin Veretennicov : -- nosy: +kveretennicov ___ Python tracker <http://bugs.python.org/issue4573> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8402] glob returns empty list with "[" character in the folder name
Changes by Constantin Veretennicov : -- nosy: +kveretennicov ___ Python tracker <http://bugs.python.org/issue8402> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com