Re: dict diff

2010-11-20 Thread geremy condra
On Sat, Nov 20, 2010 at 4:00 AM, 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 >>

Re: dict diff

2010-11-20 Thread Jin Yi
right. i moved to a 2-value tuple return value basically to illustrate exactly where each dict is providing a different value. it turns out to be much easier to grok than the 3-value one since it's all there and lines up correctly with the inputs... On Sat, Nov 20, 2010 at 12:00:16PM +, S

Re: dict diff

2010-11-20 Thread Steven D'Aprano
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. You've never wanted t

Re: dict diff

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

Re: dict diff

2010-11-19 Thread Steve Holden
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 OrderedD