mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 03:20:18 +00:00
9 lines
251 B
Python
9 lines
251 B
Python
def cache(f):
|
|
def wrapper(*args):
|
|
if not hasattr(f, '__cache__'):
|
|
f.__cache__ = {}
|
|
key = args
|
|
if key not in f.__cache__:
|
|
f.__cache__[key] = f(*args)
|
|
return f.__cache__[key]
|
|
return wrapper |