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
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
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
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
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
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
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
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
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
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
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
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
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
13 matches
Mail list logo