Weak refrences to an object can be collected if no strong refrences remain, but we can disable it!
Lists and dictionaries cannot be weak refrenced, but this can:
class Dict(dict): pass class List(list): pass
If your holding a large dictionary, you might want to split up over diffrent variables, like this:
import weakref,gc gc.disable() #no garbage collection! d = weakref.WeakValueDictionary() #if your values are large(otherwise use WeakKeyDictionary) #do what ever#
Want group things held together (no order) that also have regular value names?(Deleted when no strong refrences)