summaryrefslogtreecommitdiffstats
path: root/Lib/functools.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2010-08-14 22:29:52 (GMT)
committerRaymond Hettinger <python@rcn.com>2010-08-14 22:29:52 (GMT)
commit5202fadb2c3ceaa00fbdb8078ca462b9af0b0ea9 (patch)
tree3572da6ea975bc6185d48b127dbd6d9c8f87f4a1 /Lib/functools.py
parentcbe8813f18da15b239c58e1ba5c236c77872e413 (diff)
downloadcpython-5202fadb2c3ceaa00fbdb8078ca462b9af0b0ea9.zip
cpython-5202fadb2c3ceaa00fbdb8078ca462b9af0b0ea9.tar.gz
cpython-5202fadb2c3ceaa00fbdb8078ca462b9af0b0ea9.tar.bz2
Localize one more builtin lookup.
Diffstat (limited to 'Lib/functools.py')
-rw-r--r--Lib/functools.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/functools.py b/Lib/functools.py
index 815386b..f6ae4f4 100644
--- a/Lib/functools.py
+++ b/Lib/functools.py
@@ -119,7 +119,8 @@ def lfu_cache(maxsize=100):
http://en.wikipedia.org/wiki/Cache_algorithms#Least-Frequently_Used
"""
- def decorating_function(user_function, tuple=tuple, sorted=sorted, len=len):
+ def decorating_function(user_function, tuple=tuple, sorted=sorted,
+ len=len, KeyError=KeyError):
cache = {} # mapping of args to results
use_count = Counter() # times each key has been accessed
kwd_mark = object() # separate positional and keyword args
@@ -170,7 +171,8 @@ def lru_cache(maxsize=100):
http://en.wikipedia.org/wiki/Cache_algorithms#Least_Recently_Used
"""
- def decorating_function(user_function, tuple=tuple, sorted=sorted, len=len):
+ def decorating_function(user_function, tuple=tuple, sorted=sorted,
+ len=len, KeyError=KeyError):
cache = OrderedDict() # ordered least recent to most recent
kwd_mark = object() # separate positional and keyword args
lock = Lock()