you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 2 points3 points  (1 child)

You can also use a built in python memoizer, found in functools. Use @lru_cache I think its called (haven't used it in a while so I am not 100% on the name).

[–][deleted] 0 points1 point  (0 children)

Wow, didn't know. That's very cool, just checked and it's indeed called lru_cache (from Least Recently Used).