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 <[email protected]> wrote: > On Fri, 16 Oct 2020 at 08:42, Ram Rachum <[email protected]> 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 -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/CBBYOCHULKCG3QKHLQB6MY3ZDHY6NOTN/ Code of Conduct: http://python.org/psf/codeofconduct/
