Nick Coghlan <ncogh...@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 <rep...@bugs.python.org>
<http://bugs.python.org/issue10586>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to