Open
Description
functools.cache
, when applied to a method, caches the self
argument. This can also keep the inst
5F0A
ance alive long after it is no longer needed. See for example this discussion.
Following the same API as singledispatch
and singledispatchmethod
, we should consider adding a cachemethod
decorator that either avoids caching self
, or uses a weakref for it.