Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > dict diff

Thread Tools

dict diff

Jin Yi
Posts: n/a
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

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Diff CSS styles for diff INPUT TYPE='s? A Traveler ASP .Net 6 08-31-2004 09:17 PM
[ANN] Diff::LCS 1.1.0, Diff::LCS 1.0.4 Austin Ziegler Ruby 3 08-09-2004 06:34 AM
diff Process under diff users Cyril Vi?ville Perl 1 06-29-2004 06:22 PM
Same sessionID retuned to diff browsers in diff machines Berrucho ASP .Net 2 12-05-2003 02:23 PM