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, Oct 16, 2020 at 11:26 AM Paul Moore <p.f.mo...@gmail.com> wrote: > On Fri, 16 Oct 2020 at 08:42, Ram Rachum <r...@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 >
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/CBBYOCHULKCG3QKHLQB6MY3ZDHY6NOTN/ Code of Conduct: http://python.org/psf/codeofconduct/