Re:Show HN: File-based cache for slow Python functions
by kapilsinha on Monday March 18, 2024 @05:33PM
(#39750329)
I like the simplicity. I definitely get the payoff for standalone Python scripts, where once the script errors out the memory is cleared.
But do you see a similar payoff for Jupyter notebooks (or similar)?
[ Parent
| on HN ]
Re:Show HN: File-based cache for slow Python functions
by williamzeng0 on Monday March 18, 2024 @05:51PM
(#39750491)
I think the marginal gain would be a lot less for Jupyter notebooks, but I've definitely rerun individual cells and wasted time there before.
I think it could help if you forget to save the output of a function within a single cell like this:
1. print(f(x)) # -> check what happened 2. out = f(x) # -> turns out we want to save this, so we have to wait again
Re:Show HN: File-based cache for slow Python functions
by p10_user on Tuesday March 19, 2024 @11:37AM
(#39756877)
FWIW There is a built-in cache system for r markdown documents. I'm not up to speed on their exact implementation but I have found it useful.
Re:Show HN: File-based cache for slow Python functions
by williamzeng0 on Tuesday March 19, 2024 @12:48PM
(#39757682)
file.mtime. (file last modified) is an awesome way to key the cache.