diff options
author | Raymond Hettinger <python@rcn.com> | 2010-08-14 23:52:08 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2010-08-14 23:52:08 (GMT) |
commit | 0f56e90f0582a4171a9e3e1e2ffde2781be4bffd (patch) | |
tree | 32bc9fd46a929f5ac2115b8591d54efad1ec9efa /Lib/functools.py | |
parent | a893927491ef3bc7a4c3c9aa548be7d8ff677c38 (diff) | |
download | cpython-0f56e90f0582a4171a9e3e1e2ffde2781be4bffd.zip cpython-0f56e90f0582a4171a9e3e1e2ffde2781be4bffd.tar.gz cpython-0f56e90f0582a4171a9e3e1e2ffde2781be4bffd.tar.bz2 |
Support cache sizes.
Diffstat (limited to 'Lib/functools.py')
-rw-r--r-- | Lib/functools.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/functools.py b/Lib/functools.py index f6ae4f4..9f28004 100644 --- a/Lib/functools.py +++ b/Lib/functools.py @@ -144,7 +144,7 @@ def lfu_cache(maxsize=100): wrapper.misses += 1 if len(cache) > maxsize: # purge the 10% least frequently used entries - for key, _ in nsmallest(maxsize // 10, + for key, _ in nsmallest(maxsize // 10 or 1, use_count.items(), key=itemgetter(1)): del cache[key], use_count[key] |