razamatan_retral_net at nospam.com
Sat Nov 20 08:15:11 CET 2010
i don't think this piece of code is obscure. i think the use case is there when you know that dicta != dictb, but you need to know where they're different.
i wouldn't really care to have it on the dict since it's useful as an unbound method anyway.
On Sat, Nov 20, 2010 at 01:11:53AM -0500, Steve Holden wrote:
> On 11/19/2010 8:58 PM, Jin Yi wrote:
> > 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?
> A PEP *and* some explanation of why you would want such an obscure piece
> of code built in to the dict object, yes.
> Steve Holden +1 571 484 6266 +1 800 494 3119
> PyCon 2011 Atlanta March 9-17 http://us.pycon.org/
> See Python Video! http://python.mirocommunity.org/
> Holden Web LLC http://www.holdenweb.com/
More information about the Python-list