Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def cache3(func):
- count = {'count':0}
- cash = {}
- def wrapper(*args, **kwargs):
- ttt = count['count']
- if count['count'] == 2:
- count['count'] = 0
- cash.clear()
- else:
- #print(f'итерация{ttt}')
- count['count'] += 1
- if args not in cash:
- cash[args] = func(*args, **kwargs)
- return cash[args]
- return wrapper
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement