[issue10586] Enhanced cache access API for functools.lru_cache
Nick Coghlan
report at bugs.python.org
Tue Nov 30 05:55:33 CET 2010
Nick Coghlan <ncoghlan at gmail.com> added the comment:
Raymond suggested a simple cache_info() method that returns a named tuple as a possible alternative.
I like that idea, as it makes displaying debugging information (the intended use case for these attributes) absolutely trivial:
>>> import functools
>>> @functools.lru_cache()
... def f(x):
... return x
...
>>> f.cache_info()
lru_cache_info(maxsize=100, currsize=0, hits=0, misses=0)
(Alternative patch attached)
----------
Added file: http://bugs.python.org/file19882/functools_lru_cache_info_method.diff
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10586>
_______________________________________
More information about the Python-bugs-list
mailing list