Re: dict order

2008-06-19 Thread Aahz
In article <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> wrote: > >Whoops > >for keys, values in dict_one.items(): > if keys in dict_two: >if values == dict_two[keys]: Except that "keys" implies a plural (meaning more than one thing); in a for loop, each iteration will have only one key. -- Aahz

Re: dict order

2008-06-18 Thread cokofreedom
On Jun 18, 4:45 pm, Kirk Strauser <[EMAIL PROTECTED]> wrote: > At 2008-06-18T10:32:48Z, [EMAIL PROTECTED] writes: > > # untested 2.5 > > for keys in dict_one.items(): > > if keys in dict_two: > > if dict_one[keys] != dict_two[keys]: > > # values are different > > else: > > # key i

Re: dict order

2008-06-18 Thread Kirk Strauser
At 2008-06-18T10:32:48Z, [EMAIL PROTECTED] writes: > # untested 2.5 > for keys in dict_one.items(): > if keys in dict_two: > if dict_one[keys] != dict_two[keys]: > # values are different > else: > # key is not present That fails if there is an item in dict_two that's not in dict

Re: dict order

2008-06-18 Thread A.T.Hofkamp
On 2008-06-18, Robert Bossy <[EMAIL PROTECTED]> wrote: > Lie wrote: >>> Whoops, I think I misunderstood the question. If what you're asking >>> whether two dictionary is equal (equality comparison, rather than >>> sorting comparison). You could do something like this: >>> > Testing for equalit

Re: dict order

2008-06-18 Thread Robert Bossy
Peter Otten wrote: Robert Bossy wrote: I wish to know how two dict objects are compared. By browsing the archives I gathered that the number of items are first compared, but if the two dict objects have the same number of items, then the comparison algorithm was not mentioned. If I in

Re: dict order

2008-06-18 Thread Peter Otten
Robert Bossy wrote: > I wish to know how two dict objects are compared. By browsing the > archives I gathered that the number of items are first compared, but if > the two dict objects have the same number of items, then the comparison > algorithm was not mentioned. If I interpret the comments in

Re: dict order

2008-06-18 Thread Robert Bossy
Lie wrote: Whoops, I think I misunderstood the question. If what you're asking whether two dictionary is equal (equality comparison, rather than sorting comparison). You could do something like this: Testing for equality and finding differences are trivial tasks indeed. It is the sort order

Re: dict order

2008-06-18 Thread Lie
On Jun 18, 5:35 pm, [EMAIL PROTECTED] wrote: > On Jun 18, 12:32 pm, [EMAIL PROTECTED] wrote: > > > > > On Jun 18, 11:22 am, Robert Bossy <[EMAIL PROTECTED]> wrote: > > > > Hi, > > > > I wish to know how two dict objects are compared. By browsing the > > > archives I gathered that the number of item

Re: dict order

2008-06-18 Thread A.T.Hofkamp
On 2008-06-18, Robert Bossy <[EMAIL PROTECTED]> wrote: > Hi, > > I wish to know how two dict objects are compared. By browsing the > archives I gathered that the number of items are first compared, but if > the two dict objects have the same number of items, then the comparison > algorithm was n

Re: dict order

2008-06-18 Thread Lie
On Jun 18, 4:22 pm, Robert Bossy <[EMAIL PROTECTED]> wrote: > Hi, > > I wish to know how two dict objects are compared. By browsing the > archives I gathered that the number of items are first compared, but if > the two dict objects have the same number of items, then the comparison > algorithm was

Re: dict order

2008-06-18 Thread cokofreedom
On Jun 18, 12:32 pm, [EMAIL PROTECTED] wrote: > On Jun 18, 11:22 am, Robert Bossy <[EMAIL PROTECTED]> wrote: > > > Hi, > > > I wish to know how two dict objects are compared. By browsing the > > archives I gathered that the number of items are first compared, but if > > the two dict objects have th

Re: dict order

2008-06-18 Thread cokofreedom
On Jun 18, 11:22 am, Robert Bossy <[EMAIL PROTECTED]> wrote: > Hi, > > I wish to know how two dict objects are compared. By browsing the > archives I gathered that the number of items are first compared, but if > the two dict objects have the same number of items, then the comparison > algorithm wa

dict order

2008-06-18 Thread Robert Bossy
Hi, I wish to know how two dict objects are compared. By browsing the archives I gathered that the number of items are first compared, but if the two dict objects have the same number of items, then the comparison algorithm was not mentioned. Note that I'm not trying to rely on this order. I