Stef Mientki <[EMAIL PROTECTED]> writes: > Now I do it to make a copy of the dictionary and compare it with the > old one. > When a change is detected I nake a new copy and interpret the whole > new dictionary again, > so I'm not interested in knowing where the change(s) are located. > This works well, but as I have many of these dictionaries, > I find the copy a waste of time and space.
As a couple of people have said, you could make a dict subclass that notices when you do updates. I think the real answer is a "functional" dictionary, which means one that is never updated. You instead make a new functional dictionary that shares structure with the old one. The functional dictionary uses a balanced-tree data structure that makes this creation of new partially-shared dictionaries efficient. Look up "AVL tree" or "red-black tree" for how they work. I've been wanting for a while to get around to coding some of these structures in Python, but I'll be even happier if someone else beats me to it. -- http://mail.python.org/mailman/listinfo/python-list