Re: dict diff

2010-11-20 Thread Jin Yi
, Steven D'Aprano wrote: On Sat, 20 Nov 2010 01:11:53 -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. [...] A PEP *and* some explanation of why you would want such an obscure piece of code built in to the dict object, yes

dict diff

2010-11-19 Thread Jin Yi
, no? -- Jin Yi __author__ = 'razamatan_retral_net_ignore_com' from collections import Mapping def diffdict(left, right): ''' returns the deep diff of two dicts. the return value the tuple (left_diff, right_diff) diffdict(1, None) (1, None) diffdict({1:2}, None) ({1: 2}, None

Re: dict diff

2010-11-19 Thread Jin Yi
, 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