[issue10586] Enhanced cache access API for functools.lru_cache

2010-11-29 Thread Raymond Hettinger
Raymond Hettinger added the comment: Thx -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python

[issue10586] Enhanced cache access API for functools.lru_cache

2010-11-29 Thread Nick Coghlan
Changes by Nick Coghlan : -- stage: -> committed/rejected status: open -> closed type: -> feature request ___ Python tracker ___ ___

[issue10586] Enhanced cache access API for functools.lru_cache

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

[issue10586] Enhanced cache access API for functools.lru_cache

2010-11-29 Thread Raymond Hettinger
Raymond Hettinger 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 "with lock:" to the cache_in

[issue10586] Enhanced cache access API for functools.lru_cache

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

[issue10586] Enhanced cache access API for functools.lru_cache

2010-11-29 Thread Nick Coghlan
New submission from Nick Coghlan : 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, maxsize Methods: clear(