weakref.WeakValueDictionary.valuerefs

WeakValueDictionary.valuerefs()[source]

Return a list of weak references to the values.

The references are not guaranteed to be ‘live’ at the time they are used, so the result of calling the references needs to be checked before being used. This can be used to avoid creating references that will cause the garbage collector to keep the values around longer than needed.