summaryrefslogtreecommitdiffstats
path: root/Lib/functools.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2010-11-30 19:15:45 (GMT)
committerRaymond Hettinger <python@rcn.com>2010-11-30 19:15:45 (GMT)
commit7496b4171e6a34a82ba388fa0ef125d8b87aa2a1 (patch)
treeed8fc1ddcee597b3273caf464d2397c51bd66be4 /Lib/functools.py
parentd01df46848da8c500665cfd59b84a1ebf25f25a2 (diff)
downloadcpython-7496b4171e6a34a82ba388fa0ef125d8b87aa2a1.zip
cpython-7496b4171e6a34a82ba388fa0ef125d8b87aa2a1.tar.gz
cpython-7496b4171e6a34a82ba388fa0ef125d8b87aa2a1.tar.bz2
Add example, tighten text, and minor clean-ups.
Diffstat (limited to 'Lib/functools.py')
-rw-r--r--Lib/functools.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/functools.py b/Lib/functools.py
index e8e9960..c558a5e 100644
--- a/Lib/functools.py
+++ b/Lib/functools.py
@@ -114,7 +114,7 @@ def cmp_to_key(mycmp):
raise TypeError('hash not implemented')
return K
-_CacheInfo = namedtuple("CacheInfo", "maxsize, size, hits, misses")
+_CacheInfo = namedtuple("CacheInfo", "hits misses maxsize currsize")
def lru_cache(maxsize=100):
"""Least-recently-used cache decorator.
@@ -166,7 +166,7 @@ def lru_cache(maxsize=100):
def cache_info():
"""Report cache statistics"""
with lock:
- return _CacheInfo(maxsize, len(cache), hits, misses)
+ return _CacheInfo(hits, misses, maxsize, len(cache))
def cache_clear():
"""Clear the cache and cache statistics"""