dict diff

Jin Yi razamatan_retral_net at nospam.com
Sat Nov 20 02:58:19 CET 2010

so i came up with a diff method to compare 2 dicts.  i found it pretty
useful so i thought i'd share it with everyone.  you can see the doctest
to check out suggested uses.  since we can't modify built-ins, i
demonstrated adding a diff method to OrderedDict to show how one could
add it to your own mapping objects.

the core logic is compatible with python2 and 3 (i've only tested using
2.6.5 and 3.1.2).  the doctest is suited for python3 though.

the interface is pretty straightforward.  it would be awesome to have
this sucker as a method on the builtin dict, but that'd take a pep, no?

Jin Yi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: diffdict.py
Type: text/x-python
Size: 2062 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20101119/0e883a7a/attachment-0001.py>

More information about the Python-list mailing list