You can use a global WeakKeyDictionary keyed by the object to achieve the same without having anything on the object.
On Friday, October 16, 2020, 09:37:05 AM GMT+1, Ram Rachum <r...@rachum.com> wrote: 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.
_______________________________________________ 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/3IFTOHP6GRMEMY5KS2B4LDGXL5IZULZO/ Code of Conduct: http://python.org/psf/codeofconduct/