Skip to content

Commit 19a4f74

Browse files
functools.py: add a dummy lru_cache() implementation
1 parent 65a1411 commit 19a4f74

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

python-stdlib/functools/functools.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@ def wraps(wrapped, assigned=None, updated=None):
1717
return lambda x: x
1818

1919

20+
def lru_cache(*args, **kwargs):
21+
def lru_cache_impl(func):
22+
return func
23+
if len(args) == 1 and callable(args[0]):
24+
return lru_cache_impl(args[0])
25+
else:
26+
return lru_cache_impl
27+
28+
2029
def reduce(function, iterable, initializer=None):
2130
it = iter(iterable)
2231
if initializer is None:

0 commit comments

Comments
 (0)