diff options
author | Raymond Hettinger <python@rcn.com> | 2010-09-04 22:46:06 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2010-09-04 22:46:06 (GMT) |
commit | 02566ec89f90e5696eef062414c69a7c7ee991df (patch) | |
tree | dc8ca5b5c0ca581ebdfaafd073d901c57e9137bd /Lib/functools.py | |
parent | e9a4de51ab5ba19d4b1295aadad0533eea394b0a (diff) | |
download | cpython-02566ec89f90e5696eef062414c69a7c7ee991df.zip cpython-02566ec89f90e5696eef062414c69a7c7ee991df.tar.gz cpython-02566ec89f90e5696eef062414c69a7c7ee991df.tar.bz2 |
Adopt more descriptive attribute names as suggested on python-dev.
Diffstat (limited to 'Lib/functools.py')
-rw-r--r-- | Lib/functools.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/functools.py b/Lib/functools.py index 658081f..1effc08 100644 --- a/Lib/functools.py +++ b/Lib/functools.py @@ -142,23 +142,23 @@ def lru_cache(maxsize=100): with lock: result = cache[key] cache_renew(key) # record recent use of this key - wrapper.hits += 1 + wrapper.cache_hits += 1 except KeyError: result = user_function(*args, **kwds) with lock: cache[key] = result # record recent use of this key - wrapper.misses += 1 + wrapper.cache_misses += 1 if len(cache) > maxsize: cache_popitem(0) # purge least recently used cache entry return result - def clear(): + def cache_clear(): """Clear the cache and cache statistics""" with lock: cache.clear() - wrapper.hits = wrapper.misses = 0 + wrapper.cache_hits = wrapper.cache_misses = 0 - wrapper.hits = wrapper.misses = 0 - wrapper.clear = clear + wrapper.cache_hits = wrapper.cache_misses = 0 + wrapper.cache_clear = cache_clear return wrapper return decorating_function |