EditObj 2 includes an observation framework for Python object. Add a callback to any Python object... your callback function will be called every time the object is changed ! Really magic :-D

Observe is pure-Python and supports both old-style and new-style class instances, as well as lists, dictionaries and sets.

Example:

>>> from editobj3.observe import *
>>> start_scanning()
>>> class C: pass
...
>>> c = C()
>>> def listener(obj, type, new, old):
...   if type is object:
...     for (attr, newvalue, oldvalue) in diffdict(new, old):
...       print "c.%s was %s, is now %s" % (attr, oldvalue, newvalue)
...
>>> observe(c, listener)
>>> c.x = 1
c.x was None, is now 1