Did you mean like keeping a hidden attribute on the object with the result? Well, that'd require manually keeping track of these attributes for each method I'm caching. I do that sometimes, but it's verbose.
On Fri, 16 Oct 2020 at 08:42, Ram Rachum <ram@rachum.com> wrote:
>
> That's similar to my use case. Big mutable object (right now a state in a multi-agent simulation) with lots of methods that I want to cache.
Thanks all for the explanation of use cases.
In this specific example, if you're caching methods where self is the
"big object", wouldn't a per-class cache be a better approach? Then
the cache is automatically dropped when the object is.
Paul