diff --git a/tableaudocumentapi/multilookup_dict.py b/tableaudocumentapi/multilookup_dict.py index 39c92c6..21e2736 100644 --- a/tableaudocumentapi/multilookup_dict.py +++ b/tableaudocumentapi/multilookup_dict.py @@ -1,3 +1,6 @@ +import weakref + + def _resolve_value(key, value): try: retval = value.get(key, None) @@ -21,8 +24,8 @@ def __init__(self, args=None): args = {} super(MultiLookupDict, self).__init__(args) self._indexes = { - 'alias': {}, - 'caption': {} + 'alias': weakref.WeakValueDictionary(), + 'caption': weakref.WeakValueDictionary() } self._populate_indexes()