Detecting changes to a dict

Duncan Booth duncan.booth at invalid.invalid
Sun Sep 27 07:40:05 EDT 2009


Steven D'Aprano <steve at REMOVE-THIS-cybersource.com.au> wrote:

> Is there a fast way to see that a dict has been modified? I don't care
> what the modifications are, I just want to know if it has been
> changed, where "changed" means a key has been added, or deleted, or a
> value has been set. (Modifications to mutable values aren't
> important.) 

ZODB has PersistentDict which does this, but ZODB may or may not be 
appropriate to your particular application (and I have no idea how easily 
you can extract PersistentDict without also having a ZODB backend).

See http://www.fprimex.com/guides/programming/python-using-zodb



More information about the Python-list mailing list