Skip to content

Commit 19a1942

Browse files

File tree

function_caching.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ is a generic cache:
5252
memo = {}
5353
@wraps(function)
5454
def wrapper(*args):
55-
if args in memo:
55+
try:
5656
return memo[args]
57-
else:
57+
except KeyError:
5858
rv = function(*args)
5959
memo[args] = rv
6060
return rv

0 commit comments

Comments
 (0)