pymor.tools.weakrefcache
¶
Module Contents¶
- class pymor.tools.weakrefcache.WeakRefCache[source]¶
Simple WeakKeyDictionary-like cache.
This class allows storing additional data associated with any weakref-able object. The data is removed when the corresponding object dies. Compared to WeakKeyDictionary, object do not need to implement hashablel or comparable.
See https://github.com/python/cpython/issues/88306 for further context. The implementation here can be rather simple since we do not support iteration.