[issue10586] Enhanced cache access API for functools.lru_cache

2010-11-29 Thread Nick Coghlan
New submission from Nick Coghlan ncogh...@gmail.com: As per private email to Raymond, I would like to move the lru_cache access attributes and methods into a CacheInfo class, exposed as a cache attribute with several methods and read-only properties. Read-only properties: hits, misses,

[issue10586] Enhanced cache access API for functools.lru_cache

2010-11-29 Thread Nick Coghlan
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

[issue10586] Enhanced cache access API for functools.lru_cache

2010-11-29 Thread Raymond Hettinger
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Okay, go ahead with the second patch. With the following changes: _CacheInfo = namedtuple(CacheInfo, maxsize size hits misses) Change the variable names: cache_hits -- hits cache_misses -- misses Add a

[issue10586] Enhanced cache access API for functools.lru_cache

2010-11-29 Thread Nick Coghlan
Nick Coghlan ncogh...@gmail.com added the comment: Committed in r86878. I put a XXX note in the relevant part of the 3.2 What's New rather than updating it directly. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10586

[issue10586] Enhanced cache access API for functools.lru_cache

2010-11-29 Thread Nick Coghlan
Changes by Nick Coghlan ncogh...@gmail.com: -- stage: - committed/rejected status: open - closed type: - feature request ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10586 ___

[issue10586] Enhanced cache access API for functools.lru_cache

2010-11-29 Thread Raymond Hettinger
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Thx -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10586 ___ ___