Package advene :: Package util :: Module reftools :: Class WeakValueDictWithCallback
[hide private]
[frames] | no frames]

Class WeakValueDictWithCallback

source code

      UserDict.UserDict --+    
                          |    
weakref.WeakValueDictionary --+
                              |
                             WeakValueDictWithCallback

I extend WeakValueDictionary with a configurable callback function.

The callback function must be given *before* any value is assigned, so WeakValueDictWithCallback does not accept a dict nor keyword arguments as __init__ parameters. The callback function will be invoked after a key is removed, with that key as its only argument.

Instance Methods [hide private]
 
__init__(self, callback) source code

Inherited from weakref.WeakValueDictionary: __contains__, __getitem__, __iter__, __repr__, __setitem__, copy, get, has_key, items, iteritems, iterkeys, itervaluerefs, itervalues, pop, popitem, setdefault, update, valuerefs, values

Inherited from UserDict.UserDict: __cmp__, __delitem__, __len__, clear, keys

Class Methods [hide private]

Inherited from UserDict.UserDict: fromkeys

Method Details [hide private]

__init__(self, callback)
(Constructor)

source code 
Overrides: UserDict.UserDict.__init__