I don't understand what's unclear in this question. From what I can tell, it's a yes or no. Comments have asked "why", perhaps suggesting I don't need to do what I'm trying to do, but that doesn't invalidate the question. I'm not asking if it is the best way of solving a particular problem, I'm asking if it's a way at all.
If bools
stored a boolean literal instead of an array, the answer is a simple "yes", and if additionally x
isn't an array, then the answer is "yes in Python with functools.lru_cache
".
What's missing?
Update: thanks for everyone's feedback.
While I understand the mentioned flaws, I don't understand StackOverflow's handling of it. I wouldn't make this post if the question was closed with 3 downvotes. It was 18 downvotes, closed, deleted.
I have seen complete garbage questions not treated worse. I've also seen worse questions per closure's cited reasons treated better. Nothing in what anyone has said warrants such a response, and if this is disagreeable, then StackOverflow still has a problem.
"caching" [...] isn't the right word, that is for data not code
. - So codecache doesn't exist?