Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- stash = {}
- def f(a, b, c):
- if (a, b, c) in stash:
- return stash[a, b, c]
- else:
- # long expensive computation
- stash[a, b, c] = result
- return result
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement